diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-01-08 17:48:35 -0500 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-01-11 10:49:18 -0500 |
commit | 1aa1f0ab927e8e2e83fcbcdbcf8a1f5ae31ac153 (patch) | |
tree | 0bbb3ab6f77d4c1152fbaae66e0bc23128a28363 | |
parent | 28690ca621268763c9ecb8ef154eb3739a9317e3 (diff) |
Makefile: strip prefixed v from version.h
We also no longer do anything dynamic with dkms.conf, and we don't
rewrite any files at all, but rather pass this through as a cflag to the
compiler optionally.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Egbert Verhage <egbert@eggiecode.org>
-rw-r--r-- | src/Kbuild | 1 | ||||
-rw-r--r-- | src/Makefile | 31 | ||||
-rw-r--r-- | src/version.h | 2 |
3 files changed, 12 insertions, 22 deletions
@@ -6,6 +6,7 @@ ccflags-y := -O3 -fvisibility=hidden ccflags-$(CONFIG_WIREGUARD_DEBUG) += -DDEBUG -g ccflags-y += -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt' ccflags-y += -Wframe-larger-than=2048 +ccflags-$(if $(WIREGUARD_VERSION),y,) += -D'WIREGUARD_VERSION="$(WIREGUARD_VERSION)"' wireguard-y := main.o noise.o device.o peer.o timers.o queueing.o send.o receive.o socket.o peerlookup.o allowedips.o ratelimiter.o cookie.o netlink.o diff --git a/src/Makefile b/src/Makefile index 9899a73..c20bfd3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -19,32 +19,19 @@ ifneq ($(V),1) MAKEFLAGS += --no-print-directory endif -version.h: - @export GIT_CEILING_DIRECTORIES="$$(readlink -f ../..)" && \ - ver="#define WIREGUARD_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 - -dkms.conf: - @export GIT_CEILING_DIRECTORIES="$$(readlink -f ../..)" && \ - ver="$$(git describe --dirty 2>/dev/null)" && \ - . ./dkms.conf && \ - [ "$$PACKAGE_VERSION" != "$$ver" ] && \ - sed -i "s/PACKAGE_VERSION=.*/PACKAGE_VERSION=\"$$ver\"/" dkms.conf && \ - git update-index --assume-unchanged dkms.conf || true - -module: version.h - @$(MAKE) -C $(KERNELDIR) M=$(PWD) modules - -module-debug: version.h - @$(MAKE) -C $(KERNELDIR) M=$(PWD) V=1 CONFIG_WIREGUARD_DEBUG=y modules +WIREGUARD_VERSION = $(patsubst v%,%,$(shell GIT_CEILING_DIRECTORIES="$(PWD)/../.." git describe --dirty 2>/dev/null)) + +module: + @$(MAKE) -C $(KERNELDIR) M=$(PWD) WIREGUARD_VERSION="$(WIREGUARD_VERSION)" modules + +module-debug: + @$(MAKE) -C $(KERNELDIR) M=$(PWD) V=1 CONFIG_WIREGUARD_DEBUG=y WIREGUARD_VERSION="$(WIREGUARD_VERSION)" modules clean: @$(MAKE) -C $(KERNELDIR) M=$(PWD) clean module-install: - @$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install + @$(MAKE) -C $(KERNELDIR) M=$(PWD) WIREGUARD_VERSION="$(WIREGUARD_VERSION)" modules_install $(DEPMOD) -a $(KERNELRELEASE) install: module-install @@ -68,4 +55,4 @@ cloc: -include tests/debug.mk -.PHONY: all module module-debug module-install install dkms-install clean cloc check style version.h dkms.conf +.PHONY: all module module-debug module-install install dkms-install clean cloc check style diff --git a/src/version.h b/src/version.h index 07d1c2d..e42c50d 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1,3 @@ +#ifndef WIREGUARD_VERSION #define WIREGUARD_VERSION "0.0.20200105" +#endif |