summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2020-03-18 12:00:13 -0700
committerCommit Bot <commit-bot@chromium.org>2020-03-19 21:19:23 +0000
commita0e749b6352127b8eca690eb1928638ca302d00e (patch)
treee6d1886b4efec47a1620e321471d63990faa0256
parent6ef93e879ed22d52537e48243065de63373733ee (diff)
downloadchrome-ec-a0e749b6352127b8eca690eb1928638ca302d00e.tar.gz
Makefile.rules: prevent unnecessary updates of ec_version.h
While working on a different issue it was discovered that $(out)/RW/board/cr50/board.o is rebuilt every time make is ran, even if there has been no changes. Further investigation has shown that the problem is that $(out)/RW/board/cr50/board.o depends on $(out)/ec_version.h, which is not rebuilt unless something changed, but is declared .PHONY in Makefile.rules Turns out the declaration is supposed to be conditional on actual change in ec_version.h, but the condition is always True. This in turn was due to the fact that when checking if there is a change, some relevant make variables (CR50_DEV, CR50_SQA, and CRYPTO_TEST) were not set when invoking ./util/getversion.sh. When the variables are set, ec_version.h is not decalred PHONY, no unnecessary compilation is invoked. BUG=none TEST=repetitive running of make BOARD=cr50 CR50_DEV=1 build/cr50/RW/board/cr50/board.o does not trigger recompilation of board.o any more Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: Ibe75bcda9a774e748f973d85841bbde9c29fd104 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2108920 Reviewed-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
-rw-r--r--Makefile.rules4
1 files changed, 3 insertions, 1 deletions
diff --git a/Makefile.rules b/Makefile.rules
index cdbdb14b33..1f9b05b1af 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -519,7 +519,9 @@ $(out)/RW/%.a:
# Conditionally force the rebuilding of ec_version.h only if it would be
# changed.
old_version_hash := $(shell cat $(out)/ec_version.h 2> /dev/null | md5sum -)
-new_version_hash := $(shell BOARD=$(BOARD) ./util/getversion.sh | md5sum -)
+new_version_hash := $(shell BOARD=$(BOARD) CR50_DEV=$(CR50_DEV) \
+ CR50_SQA=$(CR50_SQA) CRYPTO_TEST=$(CRYPTO_TEST) \
+ ./util/getversion.sh | md5sum -)
ifneq ($(old_version_hash),$(new_version_hash))
.PHONY: $(out)/ec_version.h