Makefile: Use correct timezone for U_BOOT_TZ
authorChris Packham <judge.packham@gmail.com>
Thu, 13 Aug 2015 06:08:27 +0000 (18:08 +1200)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 10 Sep 2015 09:29:49 +0000 (11:29 +0200)
When building with SOURCE_DATE_EPOCH the timezone is in UTC. When
building normally the timezone is taken from the build machine's locale
setting.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Paul Kocialkowski <contact@paulk.fr>
Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
Makefile

index 6895830..c2a7696 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1283,10 +1283,16 @@ define filechk_version.h
 endef
 
 define filechk_timestamp.h
-       (SOURCE_DATE="$${SOURCE_DATE_EPOCH:+@$$SOURCE_DATE_EPOCH}"; \
-       LC_ALL=C date -u -d "$${SOURCE_DATE:-now}" +'#define U_BOOT_DATE "%b %d %C%y"'; \
-       LC_ALL=C date -u -d "$${SOURCE_DATE:-now}" +'#define U_BOOT_TIME "%T"'; \
-       LC_ALL=C date -u -d "$${SOURCE_DATE:-now}" +'#define U_BOOT_TZ "%z"' )
+       (if test -n "$${SOURCE_DATE_EPOCH}"; then \
+               SOURCE_DATE="@$${SOURCE_DATE_EPOCH}"; \
+               LC_ALL=C date -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"'; \
+               LC_ALL=C date -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; \
+               LC_ALL=C date -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; \
+       else \
+               LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \
+               LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \
+               LC_ALL=C date +'#define U_BOOT_TZ "%z"'; \
+       fi)
 endef
 
 $(version_h): include/config/uboot.release FORCE