-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
65 lines (48 loc) · 2.04 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
CC=gcc
DRIVERDIR?=`pwd`/driver
KDIR?=/lib/modules/`uname -r`/build
MODULEDIR?=/lib/modules/`uname -r`/kernel/drivers/usb
default: build
debug: EXTRA_CFLAGS := -DDEBUG
debug: default
build:
$(MAKE) CC=$(CC) EXTRA_CFLAGS=$(EXTRA_CFLAGS) -C $(KDIR) M=$(DRIVERDIR)
debug_install: debug install
install: default
@sudo insmod $(DRIVERDIR)/maccel.ko;
@mkdir -p $(MODULEDIR)
@sudo cp -v $(DRIVERDIR)/*.ko $(MODULEDIR);
@sudo chown -v root:root $(MODULEDIR)/*.ko;
sudo groupadd -f maccel;
sudo depmod;
sudo chown -v :maccel /sys/module/maccel/parameters/* /dev/maccel;
sudo chmod g+r /dev/maccel;
ls -l /sys/module/maccel/parameters/*
uninstall: clean
@sudo rm -fv $(MODULEDIR)/maccel.ko
@sudo rmmod maccel
refresh: default uninstall
@sudo make install
refresh-debug: default uninstall
@sudo make debug_install
build_cli:
cargo build --release --manifest-path=cli/Cargo.toml
cargo build --release --manifest-path=cli/usbmouse/Cargo.toml
install_cli: build_cli
sudo install -m 755 `pwd`/cli/target/release/maccel /usr/local/bin/maccel
sudo install -m 755 `pwd`/cli/usbmouse/target/release/maccel-driver-binder /usr/local/bin/maccel-driver-binder
uninstall_cli:
@sudo rm -f /usr/local/bin/maccel
@sudo rm -f /usr/local/bin/maccel-driver-binder
udev_install: install_cli
sudo install -m 644 -v -D `pwd`/udev_rules/99-maccel.rules /usr/lib/udev/rules.d/99-maccel.rules
sudo install -m 755 -v -D `pwd`/udev_rules/maccel_param_ownership_and_resets /usr/lib/udev/maccel_param_ownership_and_resets
udev_uninstall:
@sudo rm -f /usr/lib/udev/rules.d/99-maccel*.rules /usr/lib/udev/maccel_*
sudo udevadm control --reload-rules
sudo /usr/local/bin/maccel-driver-binder unbindall
udev_trigger:
udevadm control --reload-rules
udevadm trigger --subsystem-match=usb --subsystem-match=input --subsystem-match=hid --attr-match=bInterfaceClass=03 --attr-match=bInterfaceSubClass=01 --attr-match=bInterfaceProtocol=02
clean:
rm -rf $(DRIVERDIR)/.*.cmd $(DRIVERDIR)/*.ko $(DRIVERDIR)/*.mod $(DRIVERDIR)/*.mod.* $(DRIVERDIR)/*.symvers $(DRIVERDIR)/*.order $(DRIVERDIR)/*.o