From 9c57d6a8421a109ee3e87567c9add579f9ae761e Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 5 Dec 2014 12:32:09 -0800 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/233571 Reviewed-by: Aaron Durbin --- Makefile | 2 +- Makefile.inc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5e58cedde5..b71b93cb43 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/Makefile.inc b/Makefile.inc index d82de694d4..2576ba0dc5 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -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))))