2003-05-05 Roland McGrath <roland@redhat.com>

* 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.
This commit is contained in:
Roland McGrath 2003-05-05 19:13:59 +00:00
parent 4661a15343
commit 7f3a54bdf9

View File

@ -125,25 +125,6 @@ $(common-objpfx)%.latest: $(common-objpfx)abi-versions.h
endif # avoid-generated endif # avoid-generated
endif # $(versioning) = yes 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. # Make sure the subdirectory for object files gets created.
ifdef objpfx ifdef objpfx
ifeq (,$(wildcard $(objpfx).)) ifeq (,$(wildcard $(objpfx).))
@ -165,6 +146,14 @@ ifdef before-compile
$(before-compile): $(before-compile):
endif 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 ifndef subdir
# If a makefile needs to do something conditional on something that # If a makefile needs to do something conditional on something that
# can only be figured out from headers, write a FOO.make.c input # 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 # We only generate these in the top-level makefile, to avoid any weirdness
# from subdir-specific makefile tweaks creeping in on an update. # 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 rm -f $@T $@.dT
(echo '# Generated from $*.make.c by Makerules.'; \ (echo '# Generated from $*.make.c by Makerules.'; \
$(CC) $(CFLAGS) $(CPPFLAGS) -E $< \ $(CC) $(CFLAGS) $(CPPFLAGS) -E $< \
@ -190,6 +179,24 @@ sed-remove-dotdot := -e 's@ *\.\.\/\([^ \]*\)@ $$(..)\1@g'
else else
sed-remove-dotdot := -e 's@ *\([^ \/$$][^ \]*\)@ $$(..)\1@g' sed-remove-dotdot := -e 's@ *\([^ \/$$][^ \]*\)@ $$(..)\1@g'
endif 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 # 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 # each sysdep directory. The old method was to use vpath to search all the