summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorCraig Hesling <hesling@chromium.org>2020-12-29 17:46:28 -0800
committerCommit Bot <commit-bot@chromium.org>2021-02-03 03:56:06 +0000
commit092a0eb3b9300d8f896a974fb6faaffac28a1610 (patch)
treef9e36dba00449a25c05268dfe262813ac762bc40 /Makefile
parent4d1edeef0b4533f6a4a9814cf335998c5c03bf95 (diff)
downloadchrome-ec-092a0eb3b9300d8f896a974fb6faaffac28a1610.tar.gz
make/util: Modularize util make var building
The key objectives are to * allow util targets to be added from outside of util/build.mk (for adding tools per board, like ectool_servo) * allow for easier conditioning of tool inclusion (for auto adding tools based on characteristic, like CHIP_NPCX) * reduce the number of tools being built (we can remove irrelevant tools for some boards, like removing stm32mon for npcx boards or iteflash for stm32 boards) We have tons of boards in EC now. This takes a significant amount of time to build, so we should be a bit more careful when adding utils for all boards. This and subsequent changes sets the precedent for selectivity. This shifts the initialization/control to the board and baseboard's build.mk and allows the util/build.mk to add items to these variables. Ideally, we would use multiple variables to aggregate the utils selection from the three sources (baseboard/build.mk, board/build.mk, and util/build.mk), but I don't think the addition complexity is currently warranted. BRANCH=none BUG=b:176500425 TEST=# Check all output artifacts from before and after this CL. make clobber make buildall STATIC_VERSION=1 -j mv build build-orig # Apply the change make clobber make buildall STATIC_VERSION=1 -j diff <(find build-orig | sed 's/build-orig//' | sort) <(find build | sed 's/build//' | sort) # Nothing should be different Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I23153850eda10fc1c88d386b9f3cd8296df9c6f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606511 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 25 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index d00a5a5615..aa2037e347 100644
--- a/Makefile
+++ b/Makefile
@@ -310,6 +310,31 @@ endef
$(eval $(call get_sources,y))
$(eval $(call get_sources,ro))
+# The following variables are meant to be initialized in the baseboard or
+# board's build.mk. They will later be appended to in util/build.mk with
+# utils that should be generated for all boards.
+#
+# build-util-bin-y - Utils for the system doing the "build".
+# For example, the 64-bit x86 GNU/Linux running make.
+# These are often program that are needed by the build
+# system to generate code for use in firmware.
+# host-util-bin-y - Utils for the target platform on top of the EC.
+# For example, the 32-bit x86 Chromebook.
+# build-util-art-y - Build ?artifacts? for the system doing the "build"
+#
+# The util targets added to these variable will pickup extra build objects
+# from their optional <util_name>-objs make variable.
+#
+# See commit bc4c1b4 for more context.
+build-utils := $(call objs_from_dir,$(out)/util,build-util-bin)
+host-utils := $(call objs_from_dir,$(out)/util,host-util-bin)
+build-art := $(call objs_from_dir,$(out),build-util-art)
+# Use the util_name with an added .c AND the special <util_name>-objs variable.
+build-srcs := $(foreach u,$(build-util-bin-y),$(sort $($(u)-objs:%.o=util/%.c) \
+ $(wildcard util/$(u).c)))
+host-srcs := $(foreach u,$(host-util-bin-y),$(sort $($(u)-objs:%.o=util/%.c) \
+ $(wildcard util/$(u).c)))
+
dirs=core/$(CORE) chip/$(CHIP) $(BASEDIR) $(BDIR) common fuzz power test \
cts/common cts/$(CTS_MODULE) $(out)/gen
dirs+= private private-kandou $(PDIR) $(PBDIR)