forked from JacKeTUs/hid-logitech-hidpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (33 loc) · 879 Bytes
/
Makefile
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
33
34
35
36
37
38
39
40
41
42
KVERSION := `uname -r`
KDIR := /lib/modules/${KVERSION}/build
LSMOD_GREP = $(shell lsmod | grep "hid_logitech_hidpp")
LSUSB_GREP = $(shell lsusb | grep "Logitech, Inc. PRO Racing Wheel")
default:
$(MAKE) -C $(KDIR) M=$$PWD
install: default
$(MAKE) -C $(KDIR) M=$$PWD modules_install
depmod -A
insmod ./hid-logitech-hidpp.ko
uninstall:
ifeq ($(LSMOD_GREP),)
@echo "module not installed, doing nothing"; \
exit 1
else
@echo "hid_logitech_hidpp module is installed, attempting to remove"
endif
ifeq ($(LSUSB_GREP),)
@echo "device unplugged, OK to continue"
else
@echo "ERROR: device is still plugged in, DO NOT RMMOD!"
exit 1
endif
@echo "checking if superuser"
ifeq ($(shell id -u), 0)
@echo "user is superuser, removing module"
rmmod hid-logitech-hidpp
else
@echo "ERROR: must uninstall as superuser"
exit 1
endif
clean:
$(MAKE) -C $(KDIR) M=$$PWD clean