Use repeatable timestamps
This moves all of the date references under build/ to using a single
datetime that can be set manually using BUILD_DATETIME.
It also adds an option, OVERRIDE_C_DATE_TIME, that if set to true, will
redefine __DATE__ and __TIME__ for all C/C++ files so that it matches
BUILD_DATETIME.
Bug: 23117013
Change-Id: I880ef103a26bca86bd7bf42d58e62e740a6228c8
diff --git a/core/main.mk b/core/main.mk
index b290ce1..87bcd13 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -102,8 +102,11 @@
# Write the build number to a file so it can be read back in
# without changing the command line every time. Avoids rebuilds
# when using ninja.
-$(shell mkdir -p $(OUT_DIR) && echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt)
+$(shell mkdir -p $(OUT_DIR) && \
+ echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt && \
+ echo -n "$(BUILD_DATETIME)" > $(OUT_DIR)/build_date.txt)
BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt)
+BUILD_DATETIME_FROM_FILE := $$(cat $(OUT_DIR)/build_date.txt)
# CTS-specific config.
-include cts/build/config.mk