From patchwork Fri Oct 31 22:09:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 3516 Received: (qmail 12346 invoked by alias); 31 Oct 2014 22:09:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 12335 invoked by uid 89); 31 Oct 2014 22:09:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath to: "libc-alpha@sourceware.org" CC: Matthew Fortune Subject: [COMMITTED PATCH] BZ#17496: Fix gnu/lib-names.h dependency. In-Reply-To: Matthew Fortune's message of Friday, 31 October 2014 20:13:04 +0000 <6D39441BF12EF246A7ABCE6654B0235320F64CC1@LEMAIL01.le.imgtec.org> References: <6D39441BF12EF246A7ABCE6654B0235320F64CC1@LEMAIL01.le.imgtec.org> Message-Id: <20141031220923.CD8A42C3ACA@topped-with-meat.com> Date: Fri, 31 Oct 2014 15:09:23 -0700 (PDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=noBm7_Zk3yrIp17yriwA:9 a=CjuIK1q_8ugA:10 This does the trick. I hope the scare comment will help prevent introducing similar bugs in the future. I'll try to remember the issue when reviewing any future makefile changes that involve before-compile. Thanks, Roland 2014-10-31 Roland McGrath [BZ #17496] * Makerules: Move gnu/lib-names.h generation chunk up, to right after gen-as-const-headers chunk. Add a big scare comment after the last safe place to touch before-compile. --- a/Makerules +++ b/Makerules @@ -211,6 +211,73 @@ $(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.awk $(..)Makerules \ mv -f $@T $@ endif +ifeq (yes,$(build-shared)) +# Generate the header containing the names of all shared libraries. +# We use a stamp file to avoid unnecessary recompilations. +before-compile += $(common-objpfx)gnu/lib-names.h +ifeq ($(soversions.mk-done),t) +ifndef abi-variants +lib-names-h-abi = gnu/lib-names.h +lib-names-stmp-abi = gnu/lib-names.stmp +else +lib-names-h-abi = gnu/lib-names-$(default-abi).h +lib-names-stmp-abi = gnu/lib-names-$(default-abi).stmp +before-compile += $(common-objpfx)$(lib-names-h-abi) +common-generated += gnu/lib-names.h +install-others-nosubdir: $(inst_includedir)/$(lib-names-h-abi) +$(common-objpfx)gnu/lib-names.h: + $(make-target-directory) + { \ + echo '/* This file is automatically generated.';\ + echo ' It defines macros to allow user program to find the shared'; \ + echo ' library files which come as part of GNU libc. */'; \ + echo '#ifndef __GNU_LIB_NAMES_H'; \ + echo '#define __GNU_LIB_NAMES_H 1'; \ + echo ''; \ + $(if $(abi-includes), \ + $(foreach h,$(abi-includes), echo '#include <$(h)>';) \ + echo '';) \ + $(foreach v,$(abi-variants),\ + $(if $(abi-$(v)-condition),\ + echo '#if $(abi-$(v)-condition)'; \ + echo '# include '); \ + $(if $(abi-$(v)-condition),echo '#endif';)) \ + echo ''; \ + echo '#endif /* gnu/lib-names.h */'; \ + } > $@ +endif +$(common-objpfx)$(lib-names-h-abi): $(common-objpfx)$(lib-names-stmp-abi); @: +$(common-objpfx)$(lib-names-stmp-abi): $(..)scripts/lib-names.awk \ + $(common-objpfx)soversions.i + $(make-target-directory) + { \ + $(if $(abi-variants), \ + echo '/* This file is automatically generated. */';\ + echo '#ifndef __GNU_LIB_NAMES_H'; \ + echo '# error "Never use <$(lib-names-h-abi)> directly; include instead."'; \ + echo '#endif';, \ + echo '/* This file is automatically generated.';\ + echo ' It defines macros to allow user program to find the shared'; \ + echo ' library files which come as part of GNU libc. */'; \ + echo '#ifndef __GNU_LIB_NAMES_H'; \ + echo '#define __GNU_LIB_NAMES_H 1';) \ + echo ''; \ + ($(foreach s,$(all-sonames), echo $(s);)) \ + | LC_ALL=C $(AWK) -f $(firstword $^) | LC_ALL=C sort; \ + $(if $(abi-variants),, \ + echo ''; \ + echo '#endif /* gnu/lib-names.h */';) \ + } > ${@:stmp=T} + $(move-if-change) ${@:stmp=T} ${@:stmp=h} + touch $@ +endif +common-generated += $(lib-names-h-abi) $(lib-names-stmp-abi) +endif + +############################################################################### +# NOTE! Everything adding to before-compile needs to come before this point! # +############################################################################### + # Generate an ordered list of implicit rules which find the source files in # each sysdep directory. The old method was to use vpath to search all the # sysdep directories. However, that had the problem that a .S file in a @@ -1276,7 +1343,7 @@ endif endif endif - + # These will have been set by sysdeps/posix/Makefile. L_tmpnam ?= 1 TMP_MAX ?= 0 @@ -1324,69 +1391,6 @@ ifndef no_deps -include $(stdio_lim:h=d) endif common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st - -ifeq (yes,$(build-shared)) -# Generate the header containing the names of all shared libraries. -# We use a stamp file to avoid unnecessary recompilations. -before-compile += $(common-objpfx)gnu/lib-names.h -ifeq ($(soversions.mk-done),t) -ifndef abi-variants -lib-names-h-abi = gnu/lib-names.h -lib-names-stmp-abi = gnu/lib-names.stmp -else -lib-names-h-abi = gnu/lib-names-$(default-abi).h -lib-names-stmp-abi = gnu/lib-names-$(default-abi).stmp -before-compile += $(common-objpfx)$(lib-names-h-abi) -common-generated += gnu/lib-names.h -install-others-nosubdir: $(inst_includedir)/$(lib-names-h-abi) -$(common-objpfx)gnu/lib-names.h: - $(make-target-directory) - { \ - echo '/* This file is automatically generated.';\ - echo ' It defines macros to allow user program to find the shared'; \ - echo ' library files which come as part of GNU libc. */'; \ - echo '#ifndef __GNU_LIB_NAMES_H'; \ - echo '#define __GNU_LIB_NAMES_H 1'; \ - echo ''; \ - $(if $(abi-includes), \ - $(foreach h,$(abi-includes), echo '#include <$(h)>';) \ - echo '';) \ - $(foreach v,$(abi-variants),\ - $(if $(abi-$(v)-condition),\ - echo '#if $(abi-$(v)-condition)'; \ - echo '# include '); \ - $(if $(abi-$(v)-condition),echo '#endif';)) \ - echo ''; \ - echo '#endif /* gnu/lib-names.h */'; \ - } > $@ -endif -$(common-objpfx)$(lib-names-h-abi): $(common-objpfx)$(lib-names-stmp-abi); @: -$(common-objpfx)$(lib-names-stmp-abi): $(..)scripts/lib-names.awk \ - $(common-objpfx)soversions.i - $(make-target-directory) - { \ - $(if $(abi-variants), \ - echo '/* This file is automatically generated. */';\ - echo '#ifndef __GNU_LIB_NAMES_H'; \ - echo '# error "Never use <$(lib-names-h-abi)> directly; include instead."'; \ - echo '#endif';, \ - echo '/* This file is automatically generated.';\ - echo ' It defines macros to allow user program to find the shared'; \ - echo ' library files which come as part of GNU libc. */'; \ - echo '#ifndef __GNU_LIB_NAMES_H'; \ - echo '#define __GNU_LIB_NAMES_H 1';) \ - echo ''; \ - ($(foreach s,$(all-sonames), echo $(s);)) \ - | LC_ALL=C $(AWK) -f $(firstword $^) | LC_ALL=C sort; \ - $(if $(abi-variants),, \ - echo ''; \ - echo '#endif /* gnu/lib-names.h */';) \ - } > ${@:stmp=T} - $(move-if-change) ${@:stmp=T} ${@:stmp=h} - touch $@ -endif -common-generated += $(lib-names-h-abi) $(lib-names-stmp-abi) -endif FORCE: