build system: generalize src-to-obj
It can now be used on any list of files instead of assuming to work on $($(class)-src). This is inspired by the commit listed below, but rewritten to match upstream, and split in smaller pieces to keep intent clear. Change-Id: Ib77afedd4c3f847963497beea503f5447a7c6e28 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/9161 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@google.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
cbe27469c1
commit
10f86b0bd8
4
Makefile
4
Makefile
|
@ -203,8 +203,8 @@ endif
|
||||||
# Eliminate duplicate mentions of source files in a class
|
# Eliminate duplicate mentions of source files in a class
|
||||||
$(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs))))
|
$(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs))))
|
||||||
|
|
||||||
src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $($(1)-srcs))))
|
src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $(2))))
|
||||||
$(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class))))
|
$(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class),$($(class)-srcs))))
|
||||||
|
|
||||||
# Save all objs before processing them (for dependency inclusion)
|
# Save all objs before processing them (for dependency inclusion)
|
||||||
originalobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var)))
|
originalobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var)))
|
||||||
|
|
Loading…
Reference in New Issue