diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-12-27 18:17:00 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-12-27 18:33:55 +0100 |
commit | 3bfe9c41ab9e93646a51e64d53661153d5429817 (patch) | |
tree | e69ab4fc3102b3443f2689d50640247e4b1ca332 /src | |
parent | fuzz: find bugs when parsing uapi input (diff) | |
download | wireguard-tools-3bfe9c41ab9e93646a51e64d53661153d5429817.tar.xz wireguard-tools-3bfe9c41ab9e93646a51e64d53661153d5429817.zip |
Makefile: rework automatic version.h mangling
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Joe Doss <joe@solidadmin.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 14 | ||||
-rw-r--r-- | src/version.h | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/Makefile b/src/Makefile index e5b2230..049d555 100644 --- a/src/Makefile +++ b/src/Makefile @@ -46,6 +46,10 @@ CFLAGS += -DRUNSTATEDIR="\"$(RUNSTATEDIR)\"" ifeq ($(DEBUG),yes) CFLAGS += -g endif +GIT_VERSION := $(shell GIT_CEILING_DIRECTORIES="$(PWD)/../.." git describe --dirty 2>/dev/null) +ifneq ($(GIT_VERSION),) +CFLAGS += -D'WIREGUARD_TOOLS_VERSION="$(GIT_VERSION:v%=%)"' +endif ifeq ($(PLATFORM),linux) LIBMNL_CFLAGS := $(shell $(PKG_CONFIG) --cflags libmnl 2>/dev/null) LIBMNL_LDLIBS := $(shell $(PKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl) @@ -96,17 +100,9 @@ install: wg @[ "$(WITH_WGQUICK)" = "yes" -a "$(WITH_SYSTEMDUNITS)" = "yes" ] || exit 0; \ install -v -d "$(DESTDIR)$(SYSTEMDUNITDIR)" && install -v -m 0644 systemd/wg-quick@.service "$(DESTDIR)$(SYSTEMDUNITDIR)/wg-quick@.service" -wg.o: version.h -version.h: - @export GIT_CEILING_DIRECTORIES="$(PWD)/../.." && \ - ver="#define WIREGUARD_TOOLS_VERSION \"$$(git describe --dirty 2>/dev/null)\"" && \ - [ "$$(cat version.h 2>/dev/null)" != "$$ver" ] && \ - echo "$$ver" > version.h && \ - git update-index --assume-unchanged version.h || true - check: clean scan-build --html-title=wireguard-tools -maxloop 100 --view --keep-going $(MAKE) wg -.PHONY: clean install version.h check +.PHONY: clean install check -include *.d diff --git a/src/version.h b/src/version.h index c382f86..92406d5 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1,3 @@ +#ifndef WIREGUARD_TOOLS_VERSION #define WIREGUARD_TOOLS_VERSION "1.0.20191226" +#endif |