diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2019-03-26 14:57:54 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-05-10 10:43:54 -0700 |
commit | 22b1008446791f31d8841b8ae43bbbc0f4d9f143 (patch) | |
tree | cd9cf0afc83083980ee644ff415e04a47eabedba /Makefile | |
parent | 8dadabb6810cba442e17025d292444f63880638d (diff) | |
download | chrome-ec-22b1008446791f31d8841b8ae43bbbc0f4d9f143.tar.gz |
cr50: rebuild board image if essential make variables change
When building Cr50 board image, some make variables get converted into
compilation flags, which affect image composition. Changes of these
variables go unnoticed as they do not directly affect make
dependencies.
Let's define the set of essential variables in ENV_VARS, and save the
state of these variables at build time in a generated .h file,
updating it only if any of the variables' values changed since the
previous make run.
The generated .h file is included in board.h, which guarantees that
files dependent on board.h are recompiled if the generated .h file
changes.
BRANCH=cr50
BUG=none
TEST=verified that changing of CR50_DEV and/or H1_RED_BOARD or
CR50_SQA values triggers full rebuild of the Cr50 image.
Verified that 'emerge-atlas ec-utils' also succeeds.
Change-Id: Id0589a3b6a66fe4da90a9aea894bc83eb6337c8c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/707915
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -86,6 +86,15 @@ not_cfg = $(subst ro rw,y,$(filter-out $(1:y=ro rw),ro rw)) # The board makefile sets $CHIP and the chip makefile sets $CORE. # Include those now, since they must be defined for _flag_cfg below. include $(BDIR)/build.mk + +ifneq ($(ENV_VARS),) +# Let's make sure $(out)/env_config.h changes if value any of the above +# variables has changed since the prvious make invocation. This in turn will +# make sure that relevant object files are re-built. +current_set = $(foreach env_flag, $(ENV_VARS), $(env_flag)=$($(env_flag))) +$(shell util/env_changed.sh "$(out)/env_config.h" "$(current_set)") +endif + # Baseboard directory ifneq (,$(BASEBOARD)) BASEDIR:=baseboard/$(BASEBOARD) @@ -153,7 +162,10 @@ CPPFLAGS_RO+=$(foreach t,$(_tsk_cfg_ro),-D$(t)) \ CPPFLAGS_RW+=$(foreach t,$(_tsk_cfg_rw),-D$(t)) \ $(foreach t,$(_tsk_cfg_ro),-D$(t)_RO) CPPFLAGS+=$(foreach t,$(_tsk_cfg),-D$(t)) - +ifneq ($(ENV_VARS),) +CPPFLAGS += -DINCLUDE_ENV_CONFIG +CFLAGS += -I$(realpath $(out)) +endif # Get the CONFIG_ and VARIANT_ options that are defined for this target and make # them into variables available to this build script _flag_cfg_ro:=$(shell $(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) \ |