diff options
-rw-r--r-- | Makerules | 47 |
1 files changed, 27 insertions, 20 deletions
@@ -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 |