From a3abe83f096a60a37eee2eb32cd77febac3a01c9 Mon Sep 17 00:00:00 2001 From: Lauri Tirkkonen Date: Sun, 31 Oct 2021 23:13:32 +0200 Subject: [PATCH] generate version at compile time --- .gitignore | 1 + Makefile | 5 +++++ configure | 1 - net.c | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 86081dd..285b95d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /conf.mk /config/out /libressl-* +/version.h diff --git a/Makefile b/Makefile index 8ec0220..ccdb3a1 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,11 @@ WARNINGS= yes LINKS= ${BINDIR}/${PROG} ${BINDIR}/test_parser # required for asprintf on glibc COPTS+= -D_GNU_SOURCE +COPTS+= -I${.OBJDIR} + +net.o: version.h +version.h: .git + echo '#define PROXY_VERSION "'$$(git describe --dirty)'"' > $@ .include "conf.mk" .ifndef HAVE_LIBTLS diff --git a/configure b/configure index 099baf0..3359b1e 100755 --- a/configure +++ b/configure @@ -5,7 +5,6 @@ exec 3> config.h exec 4> conf.mk echo '#ifndef CONFIG_H' >&3 echo '#define CONFIG_H' >&3 -echo "#define PROXY_VERSION \"$(git describe --dirty)\"" >&3 CC=${CC-cc} color=color.c diff --git a/net.c b/net.c index f6387d9..8729555 100644 --- a/net.c +++ b/net.c @@ -10,6 +10,7 @@ #include #include "config.h" #include "net.h" /* */ +#include "version.h" static int socket_setblocking(int fd) -- 2.45.2