aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 5e3df6f6fa6147ace88c47222d61dc4cf367aa85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
ifneq ($(KERNELRELEASE),)
obj-m := blind-operator-mode.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default: build

install: maybe-clean blind-operator-mode.c Makefile dkms.conf
	echo blind-operator-mode > /etc/modules-load.d/blind-operator-mode.conf
	echo softdep wireguard pre: blind-operator-mode > /etc/modprobe.d/blind-operator-mode.conf
	-dkms remove blind-operator-mode/0.0.1 --all
	dkms add .
	dkms autoinstall
uninstall:
	rm -f /etc/modules-load.d/blind-operator-mode.conf
	rm -f /etc/modprobe.d/blind-operator-mode.conf
	dkms remove blind-operator-mode/0.0.1 --all
	@echo "Please reboot to fully remove blind operator mode"
build:
	$(MAKE) -C $(KERNELDIR) M=$(PWD)
clean:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
ifneq ($(wildcard *.o *.ko .tmp* .*.cmd blind-operator-mode.*),blind-operator-mode.c)
maybe-clean: clean
else
maybe-clean:
endif

.PHONY: maybe-clean clean build install uninstall
endif