summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile25
-rw-r--r--src/dkms.conf9
2 files changed, 32 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
diff --git a/src/dkms.conf b/src/dkms.conf
new file mode 100644
index 0000000..e53fbba
--- /dev/null
+++ b/src/dkms.conf
@@ -0,0 +1,9 @@
+PACKAGE_NAME="wireguard"
+PACKAGE_VERSION="0.0.20161129"
+AUTOINSTALL=yes
+
+BUILT_MODULE_NAME="wireguard"
+DEST_MODULE_LOCATION="/kernel/net"
+
+# requires kernel 4.1 or greater:
+BUILD_EXCLUSIVE_KERNEL="^(4\.[^0]|[5-9])"