summaryrefslogtreecommitdiffhomepage
path: root/src/Makefile
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-01-08 17:48:35 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2020-01-11 10:49:18 -0500
commit1aa1f0ab927e8e2e83fcbcdbcf8a1f5ae31ac153 (patch)
tree0bbb3ab6f77d4c1152fbaae66e0bc23128a28363 /src/Makefile
parent28690ca621268763c9ecb8ef154eb3739a9317e3 (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>
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile31
1 files changed, 9 insertions, 22 deletions
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