Allow to override build date

in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

This date call works with GNU and BSD variants of date.
This commit is contained in:
Bernhard M. Wiedemann 2018-07-14 04:52:39 +02:00
parent 4231370205
commit b5292709cf

View file

@ -10,7 +10,11 @@
# The version number, for release:
VER_VERSION:=0.9.23
VER_DATE:=$(shell date +"%Y-%m-%d")
ifdef SOURCE_DATE_EPOCH
VER_DATE=$(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+%Y-%m-%d" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+%Y-%m-%d" 2>/dev/null || date -u "+%Y-%m-%d")
else
VER_DATE=$(shell date "+%Y-%m-%d")
endif
MAGIC_API_VERSION:=0x00000003
# Need to know the OS