Makefile: add git versioning to dev builds

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2019-12-26 13:01:00 +01:00
parent 011bf3b9f4
commit 9130fa0450

View file

@ -96,6 +96,14 @@ 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"
.PHONY: clean install
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
.PHONY: clean install version.h
-include *.d