diff options
author | Patrick Georgi <pgeorgi@chromium.org> | 2015-04-04 15:50:20 +0200 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2015-04-06 19:14:00 +0200 |
commit | 828e0e86f3b7ddb7cde5daddc83be4386a4d43b1 (patch) | |
tree | bd8573ffb53ff1acc6d9c7b8fac86c876f4e04e3 /Makefile.inc | |
parent | d126a749b86504a6f4c3a6c572fc8a3b14de6df9 (diff) | |
download | coreboot-828e0e86f3b7ddb7cde5daddc83be4386a4d43b1.tar.gz coreboot-828e0e86f3b7ddb7cde5daddc83be4386a4d43b1.tar.xz coreboot-828e0e86f3b7ddb7cde5daddc83be4386a4d43b1.zip |
build system: run linker scripts through the preprocessor
This allows combining and simplifying linker scripts.
This is inspired by the commit listed below, but rewritten to match
upstream, and split in smaller pieces to keep intent clear.
Change-Id: Ie5c11bd8495a399561cefde2f3e8dd300f4feb98
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Based-On-Change-Id: I50af7dacf616e0f8ff4c43f4acc679089ad7022b
Based-On-Signed-off-by: Julius Werner <jwerner@chromium.org>
Based-On-Reviewed-on: https://chromium-review.googlesource.com/219170
Reviewed-on: http://review.coreboot.org/9303
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'Makefile.inc')
-rw-r--r-- | Makefile.inc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Makefile.inc b/Makefile.inc index 92f201335..d444457a2 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -112,9 +112,9 @@ files-in-dir=$(filter-out $(call dir-wildcards,$(call filter-out-dirs,$(1),$(sor ####################################################################### # reduce command line length by linking the objects of each # directory into an intermediate file -ramstage-postprocess=$(foreach d,$(sort $(dir $(1))), \ +ramstage-postprocess=$(foreach d,$(sort $(dir $(filter-out %.ld,$(1)))), \ $(eval $(d)ramstage.o: $(call files-in-dir,$(d),$(filter-out %.ld,$(1))); $$(LD_ramstage) -o $$@ -r $$^ ) \ - $(eval ramstage-objs:=$(d)ramstage.o $(filter-out $(call files-in-dir,$(d),$(1)),$(filter-out %.ld,$(ramstage-objs))))) + $(eval ramstage-objs:=$(d)ramstage.o $(filter-out $(filter-out %.ld, $(call files-in-dir,$(d),$(1))),$(ramstage-objs)))) romstage-generic-ccopts += -D__PRE_RAM__ ifeq ($(CONFIG_TRACE),y) @@ -142,9 +142,10 @@ bootblock-c-deps:=$$(OPTION_TABLE_H) # Add handler to copy linker scripts define generic-objs_ld_template_gen de$(EMPTY)fine $(1)-objs_ld_template -$$(call src-to-obj,$1,$$(1).ld): $$(1).ld +$$(call src-to-obj,$1,$$(1).ld): $$(1).ld $(obj)/config.h @printf " CP $$$$(subst $$$$(obj)/,,$$$$(@))\n" - cp $$$$< $$$$@ + $$(CC_$(1)) $$(CPPFLAGS_$(1)) $($(1)-ld-ccopts) $(PREPROCESS_ONLY) -include $(obj)/config.h $$$$< > $$$$@.tmp + mv $$$$@.tmp $$$$@ en$(EMPTY)def endef @@ -259,9 +260,6 @@ $(obj)/build.h: .xcompile util/genbuild_h/genbuild_h.sh > $(obj)/build.ht mv $(obj)/build.ht $(obj)/build.h -$(obj)/ldoptions: $(obj)/config.h - awk '/^#define ([^"])* ([^"])*$$/ {gsub("\\r","",$$3); print "PROVIDE_HIDDEN(" $$2 " = " $$3 ");";}' $< > $@ - build-dirs: mkdir -p $(objcbfs) $(objgenerated) |