diff options
Diffstat (limited to 'src')
-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 |