summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2015-03-27 17:03:28 +0100
committerPatrick Georgi <pgeorgi@google.com>2015-04-02 22:06:29 +0200
commitdb273065f67ef432937399a324364822539ca559 (patch)
tree427e4319da652712292d4d3c17f9eaa832f854f6 /Makefile
parent5c9f5342699a85b5c06f74924d730733591a64bd (diff)
downloadcoreboot-db273065f67ef432937399a324364822539ca559.tar.xz
build system: extend src-to-obj for non-.c/.S files
It also creates file names in the build directory and with the stage sliced in, but keeps the extension for anything not .c or .S. Also some handling for non-.c/.S files was adapted to match. This is inspired by the commit listed below, but rewritten to match upstream, and split in smaller pieces to keep intent clear. Change-Id: If8f89a7daffcf51f430b64c3293d2a817ae5120f 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/9175 Reviewed-by: Aaron Durbin <adurbin@google.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index c5cbda1f6d..03811c64c4 100644
--- a/Makefile
+++ b/Makefile
@@ -203,7 +203,12 @@ endif
# Eliminate duplicate mentions of source files in a class
$(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs))))
-src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $(2))))
+# Converts one or more source file paths to their corresponding build/ paths.
+# Only .c and .S get converted to .o, other files (like .ld) keep their name.
+# $1 stage name
+# $2 file path (list)
+src-to-obj=$(foreach file,$(2),$(basename $(patsubst src/%,$(obj)/%,$(file))).$(1)$(patsubst %.c,%.o,$(patsubst %.S,%.o,$(suffix $(file)))))
+
$(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class),$($(class)-srcs))))
# Save all objs before processing them (for dependency inclusion)
@@ -241,7 +246,7 @@ $(foreach class,$(classes), \
foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(subst src/,,$(basename $(file))))))
$(eval $(foreach class,$(classes),$(call foreach-src,$(class))))
-DEPENDENCIES = $(originalobjs:.o=.d)
+DEPENDENCIES = $(addsuffix .d,$(basename $(allobjs)))
-include $(DEPENDENCIES)
printall: