Makefile: Fix dependency tracking for ramstage objects

Dependency tracking in incremental builds is currently broken for the
ramstage, due to the intermediate linking step into one ramstage.o file
per directory. The original xxx.ramstage.o files are removed from
ramstage-objs, so they don't end up in allobjs and won't get translated
into DEPENDENCIES. This patch explicitly adds them to DEPENDENCIES
beforehand to resolve the issue.

BRANCH=None
BUG=None
TEST=Built, ran 'touch src/include/cbmem.h' and built again
incrementally. Confirmed that objects dependent on the modified header
such as timestamp.ramstage.o get rebuilt correctly.

Change-Id: Ife529ad8f5c011456c1e0c380356f1b1bb5047cb
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/233571
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Julius Werner 2014-12-05 12:32:09 -08:00 committed by chrome-internal-fetch
commit 9c57d6a842
2 changed files with 3 additions and 2 deletions

View file

@ -273,7 +273,7 @@ $(foreach class,$(classes), \
foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(file))))
$(eval $(foreach class,$(classes),$(call foreach-src,$(class))))
DEPENDENCIES = $(addsuffix .d,$(basename $(allobjs)))
DEPENDENCIES += $(addsuffix .d,$(basename $(allobjs)))
-include $(DEPENDENCIES)
printall:

View file

@ -95,7 +95,8 @@ files-in-dir=$(filter-out $(call dir-wildcards,$(call filter-out-dirs,$(1),$(dir
#######################################################################
# reduce command line length by linking the objects of each
# directory into an intermediate file
postprocessors += $$(foreach d,$$(sort $$(dir $$(filter %.o %.a,$$(ramstage-objs)))), \
postprocessors += $$(eval DEPENDENCIES+=$$(addsuffix .d,$$(basename $$(ramstage-objs)))) \
$$(foreach d,$$(sort $$(dir $$(filter %.o %.a,$$(ramstage-objs)))), \
$$(eval $$(d)ramstage.o: $$(call files-in-dir,$$(d),$$(ramstage-objs)); $$$$(call link,ramstage,$$$$(filter %.o %.a,$$$$(^)),-o $$$$(@),-r)) \
$$(eval ramstage-objs:=$$(d)ramstage.o $$(filter-out $$(call files-in-dir,$$(d),$$(filter %.o %.a,$$(ramstage-objs))),$$(ramstage-objs))))