From 7f3a54bdf9bcfbb0a101889058e8a30ac297d1f0 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 5 May 2003 19:13:59 +0000 Subject: 2003-05-05 Roland McGrath * Makerules (common-before-compile): New variable. ($(common-objpfx)%.make): Depend on that instead of $(before-compile). ($(common-objpfx)%.h $(common-objpfx)%.h.d): Likewise. Move this rule to after all setting of before-compile. --- Makerules | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'Makerules') diff --git a/Makerules b/Makerules index ef4658d..1398b16 100644 --- a/Makerules +++ b/Makerules @@ -125,25 +125,6 @@ $(common-objpfx)%.latest: $(common-objpfx)abi-versions.h endif # avoid-generated endif # $(versioning) = yes - -# Generating headers for assembly constants. -# We need this defined early to get into before-compile before -# it's used in sysd-rules, below. -$(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \ - %.sym $(before-compile) - $(AWK) -f $< $(filter %.sym,$^) \ - | $(CC) -S -o - $(CFLAGS) $(CPPFLAGS) -x c - \ - -MD -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)' \ - | sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' > $(@:.h.d=.h)T - sed $(sed-remove-objpfx) $(sed-remove-dotdot) \ - $(@:.h=.h.d)T > $(@:.h=.h.d)T2 - rm -f $(@:.h=.h.d)T - mv -f $(@:.h=.h.d)T2 $(@:.h=.h.d) - mv -f $(@:.h.d=.h)T $(@:.h.d=.h) -vpath %.sym $(sysdirs) -before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h) - - # Make sure the subdirectory for object files gets created. ifdef objpfx ifeq (,$(wildcard $(objpfx).)) @@ -165,6 +146,14 @@ ifdef before-compile $(before-compile): endif +# We don't want $(common-objpfx) files to depend on miscellaneous stuff +# in subdirs. +ifdef subdir +common-before-compile := $(filter-out $(objpfx)%,$(before-compile)) +else +common-before-compile = $(before-compile) +endif + ifndef subdir # If a makefile needs to do something conditional on something that # can only be figured out from headers, write a FOO.make.c input @@ -173,7 +162,7 @@ ifndef subdir # # We only generate these in the top-level makefile, to avoid any weirdness # from subdir-specific makefile tweaks creeping in on an update. -$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules $(before-compile) +$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules $(common-before-compile) rm -f $@T $@.dT (echo '# Generated from $*.make.c by Makerules.'; \ $(CC) $(CFLAGS) $(CPPFLAGS) -E $< \ @@ -190,6 +179,24 @@ sed-remove-dotdot := -e 's@ *\.\.\/\([^ \]*\)@ $$(..)\1@g' else sed-remove-dotdot := -e 's@ *\([^ \/$$][^ \]*\)@ $$(..)\1@g' endif + + +# Generating headers for assembly constants. +# We need this defined early to get into before-compile before +# it's used in sysd-rules, below. +$(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \ + %.sym $(common-before-compile) + $(AWK) -f $< $(filter %.sym,$^) \ + | $(CC) -S -o - $(CFLAGS) $(CPPFLAGS) -x c - \ + -MD -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)' \ + | sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' > $(@:.h.d=.h)T + sed $(sed-remove-objpfx) $(sed-remove-dotdot) \ + $(@:.h=.h.d)T > $(@:.h=.h.d)T2 + rm -f $(@:.h=.h.d)T + mv -f $(@:.h=.h.d)T2 $(@:.h=.h.d) + mv -f $(@:.h.d=.h)T $(@:.h.d=.h) +vpath %.sym $(sysdirs) +before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h) # 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 -- cgit v1.1