summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2015-11-02 14:24:50 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-11-04 07:08:45 -0800
commitd5e49bc23da47bca149b85682c01ef61a69e7bb8 (patch)
treec86df00977627dbbacbdb0a8eb6ec9bd893eb7fe /Makefile
parenta25c7025e11a9abc0fea873de73148770105fcb3 (diff)
downloadchrome-ec-d5e49bc23da47bca149b85682c01ef61a69e7bb8.tar.gz
make: decouple rw and ro object file sets
When building EC image, in the majority of cases the RW and RO images are built from exactly the same set of object files, and the RO set of objects is used as a template to derive the RW set of objects. This is not necessarily correct in all cases, let's just create an abstract set of object files and use it to derive the sets for RO, RW and sharedlib as appropriate. BRANCH=None BUG=chrome-os-partner:43025 TEST=tested as follows: - changed the Makefile to sort all object files in a single list (instead of sorting them by directory, with the directory list unchanged). Built all targets, saved all .smap files. Then applied this change and again built all targets. Compare all smap files, there were no differences. - modified board/samus/board.h to trigger building sharedlib objects, verified that build/samus/sharedlib built fine. Change-Id: Ie563aca62028cae9e16f067ba20b5e2930355cf5 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/310389 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 15 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 436f2358eb..1736fd1a85 100644
--- a/Makefile
+++ b/Makefile
@@ -119,7 +119,7 @@ $(eval CHIP_VARIANT_$(UC_CHIP_VARIANT)=y)
$(eval CHIP_FAMILY_$(UC_CHIP_FAMILY)=y)
# Private subdirectories may call this from their build.mk
-ro-objs_from_dir=$(sort $(foreach obj, $($(2)-y), $(out)/RO/$(1)/$(obj)))
+objs_from_dir=$(foreach obj, $($(2)-y), $(1)/$(obj))
# Get build configuration from sub-directories
# Note that this re-includes the board and chip makefiles
@@ -140,27 +140,28 @@ include util/signer/build.mk
includes+=$(includes-y)
# Get all sources to build
-all-ro-y+=$(call ro-objs_from_dir,core/$(CORE),core)
-all-ro-y+=$(call ro-objs_from_dir,chip/$(CHIP),chip)
-all-ro-y+=$(call ro-objs_from_dir,$(BDIR),board)
-all-ro-y+=$(call ro-objs_from_dir,private,private)
-all-ro-y+=$(call ro-objs_from_dir,private-cr51,private-cr51)
-all-ro-y+=$(call ro-objs_from_dir,common,common)
-all-ro-y+=$(call ro-objs_from_dir,driver,driver)
-all-ro-y+=$(call ro-objs_from_dir,power,power)
-all-ro-y+=$(call ro-objs_from_dir,test,$(PROJECT))
+all-obj-y+=$(call objs_from_dir,core/$(CORE),core)
+all-obj-y+=$(call objs_from_dir,chip/$(CHIP),chip)
+all-obj-y+=$(call objs_from_dir,$(BDIR),board)
+all-obj-y+=$(call objs_from_dir,private,private)
+all-obj-y+=$(call objs_from_dir,private-cr51,private-cr51)
+all-obj-y+=$(call objs_from_dir,common,common)
+all-obj-y+=$(call objs_from_dir,driver,driver)
+all-obj-y+=$(call objs_from_dir,power,power)
+all-obj-y+=$(call objs_from_dir,test,$(PROJECT))
dirs=core/$(CORE) chip/$(CHIP) $(BDIR) common power test
dirs+= private private-cr51
dirs+=$(shell find driver -type d)
common_dirs=util
-ro-objs := $(all-ro-y)
+ro-objs := $(sort $(foreach obj, $(all-obj-y), $(out)/RO/$(obj)))
+rw-objs := $(sort $(foreach obj, $(all-obj-y), $(out)/RW/$(obj)))
+
# Don't include the shared objects in the RO/RW image if we're enabling
# the shared objects library.
ifeq ($(CONFIG_SHAREDLIB),y)
ro-objs := $(filter-out %_sharedlib.o, $(ro-objs))
endif
-rw-objs := $(ro-objs:$(out)/RO/%=$(out)/RW/%)
ro-deps := $(ro-objs:%.o=%.o.d)
rw-deps := $(rw-objs:%.o=%.o.d)
deps := $(ro-deps) $(rw-deps)
@@ -181,8 +182,8 @@ rw: $(libsharedobjs_elf-y) $(out)/RW/$(PROJECT).RW.flat
# Shared objects library
SHOBJLIB := libsharedobjs
-sharedlib-objs := $(filter %_sharedlib.o, $(all-ro-y))
-sharedlib-objs := $(sharedlib-objs:$(out)/RO/%=$(out)/$(SHOBJLIB)/%)
+sharedlib-objs := $(filter %_sharedlib.o, $(all-obj-y))
+sharedlib-objs := $(foreach obj, $(sharedlib-objs), $(out)/$(SHOBJLIB)/$(obj))
sharedlib-deps := $(sharedlib-objs:%.o=%.o.d)
deps += $(sharedlib-deps)
def_libsharedobjs_deps := $(sharedlib-objs)