From b5292709cfe28e8be7e181e136fba5c22cfa619f Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Sat, 14 Jul 2018 04:52:39 +0200 Subject: [PATCH] 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. --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9d7378742..ae0eae74e 100644 --- a/Makefile +++ b/Makefile @@ -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