wireguard-tools/contrib/extract-keys/Makefile
Jason A. Donenfeld 1ad6b17c35 extract-{handshakes,keys}: rework for upstream kernel
Now that WireGuard has been upstreamed and the repos split, we have to
look elsewhere for these headers.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-02-01 00:53:30 +01:00

28 lines
577 B
Makefile

ifeq ($(KERNELRELEASE),)
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
CFLAGS ?= -O3 -march=native
CFLAGS += -Wall -pedantic -std=gnu11
extract-keys: extract-keys.c config.h
$(CC) $(CFLAGS) $(CPPFLAGS) -D_FILE_OFFSET_BITS=64 -o $@ -lresolv $<
config.o: config.c
$(MAKE) -C $(KERNELDIR) M=$(PWD) $@
objcopy -j '.rodata*' $@ $@
config: config.c config.o
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
config.h: config
./$< > $@
clean:
rm -f extract-keys config config.h
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
.PHONY: clean
else
obj-m := config.o
endif