From c19f876e94d3fc52d367d98352523bb52d07b753 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Tue, 29 Sep 2015 16:41:11 -0700 Subject: Makefile: Fix dependency tracking for linker scripts When the memlayout framework was initially developed in the Chromium OS tree, the accompanying build system changes unified handling for all file types (including .ld and .asl) in a single template. This had the advantage that compiler invocation options pertaining to the build system itself could be centralized in a single place. On upstreaming this was reverted for some reason, keeping the old special handling for ASL files and writing a custom template for LD. The duplicated compiler invocation code for the latter was missing the -MMD flag required for dependency tracking. It was also missing at least one $-sign which causes the $(-ld-ccopts) variable to be evaluated at the time it's parsing the template generator (before the subdirectory pass). This should not cause any issues with current code, but all the ccopts variables were meant to be evaluated after the subdirectory pass (so things like archs and SoCs can manipulate them if needed), so this patch fixes both issues. BRANCH=None BUG=None TEST='make; touch src/soc/.../memlayout.ld; make' re-links all stages and includes the changed symbol addresses from the new address map. Change-Id: I4be458112908380268229b3220cfa0062add5c5d Signed-off-by: Patrick Georgi Original-Commit-Id: e8a36f994ef6a819ded7bf6b39b1e0fce8e52279 Original-Change-Id: If2310b46b53d888975cb2113edce20a896be39ef Original-Signed-off-by: Julius Werner Original-Reviewed-on: https://chromium-review.googlesource.com/303054 Original-Reviewed-by: Aaron Durbin Original-Reviewed-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/12139 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi Tested-by: Raptor Engineering Automated Test Stand --- Makefile.inc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.inc b/Makefile.inc index 984c886819..8be9b5a50d 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -169,8 +169,7 @@ define generic-objs_ld_template_gen de$(EMPTY)fine $(1)-objs_ld_template $$(call src-to-obj,$1,$$(1).ld): $$(1).ld $(obj)/config.h @printf " CP $$$$(subst $$$$(obj)/,,$$$$(@))\n" - $$(CC_$(1)) $$(CPPFLAGS_$(1)) $($(1)-ld-ccopts) $(PREPROCESS_ONLY) -include $(obj)/config.h $$$$< > $$$$@.tmp - mv $$$$@.tmp $$$$@ + $$(CC_$(1)) -MMD $$(CPPFLAGS_$(1)) $$($(1)-ld-ccopts) $(PREPROCESS_ONLY) -include $(obj)/config.h -MT $$$$@ -o $$$$@ $$$$< en$(EMPTY)def endef -- cgit v1.2.3