diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-12-06 19:00:41 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-12-09 21:31:11 +0100 |
commit | beeb7e9278a71f128978fc82829abefde6686a7c (patch) | |
tree | 1869f3aa7275ab8245a7763765123297f92d2737 /src/Makefile | |
parent | tests: directly kill nmap (diff) | |
download | wireguard-monolithic-historical-beeb7e9278a71f128978fc82829abefde6686a7c.tar.xz wireguard-monolithic-historical-beeb7e9278a71f128978fc82829abefde6686a7c.zip |
build system: add dkms installation
Diffstat (limited to 'src/Makefile')
-rw-r--r-- | src/Makefile | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile index 20947ac..7873007 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,4 +1,9 @@ KERNELDIR ?= /lib/modules/$(shell uname -r)/build +PREFIX ?= /usr +DESTDIR ?= +SRCDIR ?= $(PREFIX)/src +DKMSDIR ?= $(SRCDIR)/wireguard + PWD := $(shell pwd) all: module tools @@ -11,6 +16,14 @@ version.h: 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 @@ -26,6 +39,14 @@ install: depmod -a $(MAKE) -C tools install +DKMS_TOP_LEVEL := Makefile Kbuild Kconfig $(filter-out wireguard.mod.c, $(wildcard *.c)) $(filter-out version.h, $(wildcard *.h)) version.h dkms.conf +DKMS_SELFTEST_LEVEL := $(wildcard selftest/*.c) $(wildcard selftest/*.h) +DKMS_CRYPTO_LEVEL := $(wildcard crypto/*.c) $(wildcard crypto/*.h) $(wildcard crypto/*.S) +dkms-install: $(DKMS_TOP_LEVEL) $(DKMS_SELFTEST_LEVEL) $(DKMS_CRYPTO_LEVEL) + @install -v -m0644 -D -t$(DESTDIR)$(DKMSDIR) $(DKMS_TOP_LEVEL) + @install -v -m0644 -D -t$(DESTDIR)$(DKMSDIR)/selftest $(DKMS_SELFTEST_LEVEL) + @install -v -m0644 -D -t$(DESTDIR)$(DKMSDIR)/crypto $(DKMS_CRYPTO_LEVEL) + tools: $(MAKE) -C tools @@ -36,6 +57,6 @@ check: cloc: clean cloc $(filter-out compat.h, $(wildcard *.c) $(wildcard *.h)) -include tests/debug.mk +-include tests/debug.mk -.PHONY: all module module-debug tools install clean core-cloc check version.h +.PHONY: all module module-debug tools install dkms-install clean core-cloc check version.h dkms.conf |