summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorCarl Hamilton <carlh@chromium.org>2016-12-15 09:54:39 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-01-05 18:40:44 -0800
commit02d9c311ec93b3dc87f8c600b9f3653e3b13009a (patch)
treeed2c1de576bf7ac462ce2bda2c37a3cf98ad9e43 /Makefile.rules
parent097008c51a5079dee002d4b33c02cf56d1517d6d (diff)
downloadchrome-ec-02d9c311ec93b3dc87f8c600b9f3653e3b13009a.tar.gz
Allow a subset of boards to be built with the "buildall" target.
In order to reduce build times during development, this change allows an engineer to build a subset of all boards, writing the results for each board into the ".failedboards" directory. The expectation is that, while working on code that affects multiple boards, the engineer will invoke "make build_boards BOARDS=<board-list>" periodically to confirm that all affected boards still build. Before pushing any code for review, however, the engineer is still expected to run "make buildall" to ensure all boards still build and tests pass. * Define a new make variable, BOARDS, whose default value is $(boards). This variable can be overridden on the make command line or via the environment. Its value must be non-empty. * Use the BOARDS make variable to control which boards will be built by the new "build_boards" and "try_build_boards" targets. * Refactor the "buildall" target so that it depends on "build_boards". This indirectly allows the boards built to be controlled via the BOARDS make variable. * Here are some make command lines that were used to test the behavior of the change: make -j buildall # Builds all boards, runs tests. make -j build_boards # Builds all boards, doesn't run tests. make -j build_boards BOARDS="cr50 reef" # Builds cr50 and reef boards make -j build_boards BOARDS= # Fails due to empty BOARDS. BUG=none BRANCH=none TEST=make -j buildall Change-Id: I833277842e5e20d86eaa90df6457264a2f86a3fa Reviewed-on: https://chromium-review.googlesource.com/420110 Commit-Ready: Carl Hamilton <carlh@chromium.org> Tested-by: Carl Hamilton <carlh@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org>
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules24
1 files changed, 18 insertions, 6 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 404454dc2a..ff1bcc5434 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -85,20 +85,32 @@ cmd_etags = etags -o $@ $(shell cat $<)
cmd_ctags = ctags -o $@ $(shell cat $<)
targ_if_prog = $(if $(shell which $(1) 2>/dev/null),$(2),)
+# By default, the "build_boards" and "try_build_boards" targets will build all
+# of the boards listed in $(boards). However, the invoker can provide a
+# different list via the BOARDS variable. Providing an empty value for BOARDS
+# is not allowed.
+BOARDS ?= $(boards)
+ifeq ($(BOARDS),)
+$(error BOARDS must be non-empty)
+endif
+
FAILED_BOARDS_DIR = .failedboards
# When building with -j, it's easy to miss errors. If you don't have your shell
# configured to warn you about nonzero exit, you may not even notice that "make
# buildall -j" failed. To make it more obvious, we'll do one level of recursion
# here.
-.PHONY: try_buildall
-try_buildall: $(foreach b, $(boards), proj-$(b))
+.PHONY: try_build_boards
+try_build_boards: $(foreach b, $(BOARDS), proj-$(b))
-.PHONY: buildall
-buildall:
+.PHONY: build_boards
+build_boards:
@rm -rf $(FAILED_BOARDS_DIR)
@mkdir $(FAILED_BOARDS_DIR)
- @for b in $(boards); do echo 'starting' > $(FAILED_BOARDS_DIR)/$$b; done
- $(MAKE) try_buildall
+ @for b in $(BOARDS); do echo 'starting' > $(FAILED_BOARDS_DIR)/$$b; done
+ $(MAKE) try_build_boards
+
+.PHONY: buildall
+buildall: build_boards
$(MAKE) build_cts
$(MAKE) runtests
@touch .tests-passed