Skip to content

Commit 9ee3773

Browse files
committed
Allow to override build date with SOURCE_DATE_EPOCH
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 only works with GNU date. This patch was done while working on reproducible builds for openSUSE.
1 parent 1827713 commit 9ee3773

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ debug: all
7474

7575
${OBJ} ${TEST_OBJ}: Makefile config.mk
7676

77+
SOURCE_DATE_EPOCH ?= $(shell date +%s)
7778
src/dunst.o: src/dunst.c
7879
${CC} -o $@ -c $< ${CPPFLAGS} ${CFLAGS} \
79-
-D_CCDATE="$(shell date '+%Y-%m-%d')" -D_CFLAGS="$(filter-out $(filter -I%,${INCS}),${CFLAGS})" -D_LDFLAGS="${LDFLAGS}"
80+
-D_CCDATE="$(shell date -d @${SOURCE_DATE_EPOCH} '+%Y-%m-%d')" -D_CFLAGS="$(filter-out $(filter -I%,${INCS}),${CFLAGS})" -D_LDFLAGS="${LDFLAGS}"
8081

8182
%.o: %.c
8283
${CC} -o $@ -c $< ${CPPFLAGS} ${CFLAGS}

0 commit comments

Comments
 (0)