From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 608583858004 for ; Sat, 12 Nov 2022 01:44:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 608583858004 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668217477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/T76hWmcVv0gReBD0MG0RtM3WWjh5iv8NJcWeCcK6IQ=; b=Bj92bFQl/ujZAbCYzNNBvNbmEUmK/ApXgyDtrY+615a1Pn/p/b1uREfL/7LYMcHeS1ZIzF P4TTMHKMLjilw9lbwId4J23juOFa+udHokPV5FGvBdN3u2571lEYTlws6hV6Xxa5litcIc EAxuai9aahsSKBq1COFJur7t845CTT0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-140-Sau3DszwPiiNxTDRql3pdA-1; Fri, 11 Nov 2022 20:44:35 -0500 X-MC-Unique: Sau3DszwPiiNxTDRql3pdA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 84F00800B23; Sat, 12 Nov 2022 01:44:34 +0000 (UTC) Received: from localhost (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BA7D477F5D; Sat, 12 Nov 2022 01:44:34 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Simplify build targets for debug library Date: Sat, 12 Nov 2022 01:44:33 +0000 Message-Id: <20221112014433.814465-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: I posted this at the start of the year while we were in stage 3. Tested x86_64-linux. Pushed to trunk. -- >8 -- This rewrites the stamp-debug and build-debug targets in src/Makefile so that each generated Makefile in the debug/$(SUBDIRS) directories is a make target, instead of being created by a loop in the stamp-debug recipe. The final adjustments to debug/Makefile are done as part of the stamp-debug target instead of the build-debug target. The advantage is that each $(SUBDIRS)/debug/Makefile now has the corresponding $(SUBDIRS)/Makefile as a prerequisite, so they will be regenerated if needed. Generating those can also be parallelized by make, although those steps are very fast so that doesn't really matter. This also removes the duplication in the stamp-debug recipe, which was using exactly the same sed command for debug/Makefile and each debug/$(SUBDIRS)/Makefile. That is done by adding "." to the list of subdirectories to process. The recipes can also be simplified to use separate shell commands per line, instead of using backslashes to join the whole recipe into a single shell command. Also replace 'echo `date` > stamp-xxx' with just 'date > stamp-xxx' which is equivalent but simpler. libstdc++-v3/ChangeLog: * src/Makefile.am: Simplify debug build targets. * src/Makefile.in: Regenerate. --- libstdc++-v3/src/Makefile.am | 65 ++++++++++++++------------------- libstdc++-v3/src/Makefile.in | 70 +++++++++++++++--------------------- 2 files changed, 56 insertions(+), 79 deletions(-) diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index b83c222d51d..b545ebf0dcf 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -30,10 +30,8 @@ endif if ENABLE_BACKTRACE backtrace_dir = libbacktrace -backtrace_supported_h = $(backtrace_dir)/backtrace-supported.h else backtrace_dir = -backtrace_supported_h = endif ## Keep this list sync'd with acinclude.m4:GLIBCXX_CONFIGURE. @@ -370,7 +368,7 @@ libstdc++convenience.la: $(toolexeclib_LTLIBRARIES) if test ! -f .libs/libstdc++.a; then \ cp .libs/libstdc++convenience.a .libs/libstdc++.a; \ fi; \ - echo `date` > stamp-libstdc++convenience; + date > stamp-libstdc++convenience; # Added rules. # 1 debug library @@ -386,50 +384,41 @@ CLEAN_DEBUG = endif # Build a debug variant. + # Take care to fix all possibly-relative paths. -debugdir = ${glibcxx_builddir}/src/debug -stamp-debug: Makefile $(foreach dir,$(SUBDIRS),$(dir)/Makefile) - if test ! -d ${debugdir} || test ! -f ${debugdir}/Makefile ; then \ - mkdir -p ${debugdir}; \ - for d in $(SUBDIRS); do mkdir -p ${debugdir}/$$d; done; \ - (cd ${debugdir}; \ - sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ - -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \ - -e 's/srcdir = \.\./srcdir = ..\/../' \ - -e 's/VPATH = \.\./VPATH = ..\/../' \ - -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \ - -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \ - < ../Makefile > Makefile ; \ - for d in . $(SUBDIRS); do \ - sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ - -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \ - -e 's/srcdir = \.\./srcdir = ..\/../' \ - -e 's/VPATH = \.\./VPATH = ..\/../' \ - -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \ - -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \ - < ../$$d/Makefile > $$d/Makefile ; \ - done) ; \ - fi; \ - echo `date` > stamp-debug; +debug/%/Makefile: %/Makefile + $(MKDIR_P) $(dir $@) + sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ + -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \ + -e 's/srcdir = \.\./srcdir = ..\/../' \ + -e 's/VPATH = \.\./VPATH = ..\/../' \ + -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \ + -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \ + < $< > $@ + +stamp-debug: $(foreach dir,. $(SUBDIRS),debug/$(dir)/Makefile) + mv debug/Makefile debug/Makefile.tmp + sed -e 's,all-local: all-once,all-local:,' \ + -e 's,install-data-local: install-data-once,install-data-local:,' \ + -e '/vpath/!s,src/c,src/debug/c,' \ + < debug/Makefile.tmp > debug/Makefile + rm -f debug/Makefile.tmp + date > stamp-debug; + +.SECONDARY: $(foreach dir,. $(SUBDIRS),debug/$(dir)/Makefile) if ENABLE_BACKTRACE -${debugdir}/$(backtrace_supported_h): $(backtrace_supported_h) stamp-debug +backtrace_supported_h = $(backtrace_dir)/backtrace-supported.h +debug_backtrace_supported_h = debug/$(backtrace_supported_h) +$(debug_backtrace_supported_h): $(backtrace_supported_h) stamp-debug cp $< $@ -debug_backtrace_supported_h = ${debugdir}/$(backtrace_supported_h) else debug_backtrace_supported_h = endif build-debug: stamp-debug $(debug_backtrace_supported_h) - (cd ${debugdir}; \ - mv Makefile Makefile.tmp; \ - sed -e 's,all-local: all-once,all-local:,' \ - -e 's,install-data-local: install-data-once,install-data-local:,' \ - -e '/vpath/!s,src/c,src/debug/c,' \ - < Makefile.tmp > Makefile ; \ - rm -f Makefile.tmp ; \ - $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug all) ; + $(MAKE) -C debug CXXFLAGS='$(DEBUG_FLAGS)' \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug all # Install debug library. install-debug: build-debug