aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/contrib/extract-handshakes/Makefile
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-02-28 00:17:43 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-03-04 18:50:25 +0100
commitd4421aea8907f15bd1b504c0377624bda752381a (patch)
treecf6b1615e900c6eb68fb49956939f17aa6e919a7 /contrib/extract-handshakes/Makefile
parentwg-quick: if resolvconf/run/iface exists, use it (diff)
downloadwireguard-tools-d4421aea8907f15bd1b504c0377624bda752381a.tar.xz
wireguard-tools-d4421aea8907f15bd1b504c0377624bda752381a.zip
contrib: add extract-handshakes kprobe example
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'contrib/extract-handshakes/Makefile')
-rw-r--r--contrib/extract-handshakes/Makefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/extract-handshakes/Makefile b/contrib/extract-handshakes/Makefile
new file mode 100644
index 0000000..36e951e
--- /dev/null
+++ b/contrib/extract-handshakes/Makefile
@@ -0,0 +1,28 @@
+ifeq ($(KERNELRELEASE),)
+KERNELDIR ?= /lib/modules/$(shell uname -r)/build
+PWD := $(shell pwd)
+CFLAGS ?= -O3 -march=native
+CFLAGS += -Wall -pedantic -std=gnu11
+
+offsets.include: offset-finder
+ ./$^ > $@
+
+offset-finder: offset-finder.c offset-finder.o
+ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
+
+offset-finder.o: offset-finder.c
+ $(MAKE) -C $(KERNELDIR) M=$(PWD) $@
+ objcopy -j '.rodata*' $@ $@
+
+clean:
+ rm -f offset-finder offsets.include
+ $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
+
+.PHONY: clean
+else
+offset-finder-m := offset-finder.o
+oldsrc := $(src)
+src := $(src)/../../../src
+include $(src)/compat/Kbuild.include
+src := $(oldsrc)
+endif