aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBernhard M. Wiedemann <bwiedemann@suse.de>2019-11-28 20:01:50 +0100
committerBernhard M. Wiedemann <bwiedemann@suse.de>2019-11-28 20:01:50 +0100
commit644bdd220e111d25e43cc5a9f457202b010e9fe9 (patch)
treeb09f186cbef233d0fa78cabd5f38a39eb9a38762 /Makefile
parentb2896c79c6ded54234a4a409f82d7cf893d23305 (diff)
downloadAFLplusplus-644bdd220e111d25e43cc5a9f457202b010e9fe9.tar.gz
Allow to override build date with SOURCE_DATE_EPOCH
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. Note: This date call is designed to work with different flavors of date (GNU, BSD and others).
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 8 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 9952ee6e..e47e1eff 100644
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,13 @@ AFL_FUZZ_FILES = $(wildcard src/afl-fuzz*.c)
PYTHON_INCLUDE ?= /usr/include/python2.7
+
+ifdef SOURCE_DATE_EPOCH
+ BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" -I 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" -I 2>/dev/null || date -u -I)
+else
+ BUILD_DATE ?= $(shell date -I)
+endif
+
ifneq "$(filter Linux GNU%,$(shell uname))" ""
LDFLAGS += -ldl
endif
@@ -299,7 +306,7 @@ source-only: all radamsa
$(MAKE) -C libtokencap
%.8: %
- @echo .TH $* 8 `date -I` "afl++" > $@
+ @echo .TH $* 8 $(BUILD_DATE) "afl++" > $@
@echo .SH NAME >> $@
@echo .B $* >> $@
@echo >> $@