-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
58 lines (47 loc) · 1.35 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
# Uncomment the following to enable debug.
#DEBUG = y
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/input/keyboard
MODULE_NAME := aziokbd
MODULE_VER := 1.0.0
ifeq ($(DEBUG),y)
DBGFLAGS = -O -g -DML_DEBUG
else
DBGFLAGS = -O2
endif
ccflags-y += $(DBGFLAGS)
ifeq ($(BKSLFIX),y)
ccflags-y += -DBACKSLASH_FIX
endif
ifneq ($(KERNELRELEASE),)
obj-m := $(MODULE_NAME).o
else
KSRC := /lib/modules/$(KVER)/build
PWD := $(shell pwd)
endif
#@if [ -n $(dkms status $(MODULE_NAME)/$(MODULE_VER)) ]; then \
define REMOVE_MODULE
@if [ -n "`dkms status $(MODULE_NAME)/$(MODULE_VER)`" ]; then \
dkms remove $(MODULE_NAME)/$(MODULE_VER) --all; \
fi;
endef
default:
$(MAKE) -C $(KSRC) M=$(PWD) modules
clean:
$(MAKE) -C $(KSRC) M=$(PWD) clean
uninstall:
rm -f $(MODDESTDIR)/$(MODULE_NAME).ko
/sbin/depmod -a ${KVER}
install:
install -p -m 644 $(MODULE_NAME).ko $(MODDESTDIR)
/sbin/depmod -a ${KVER}
dkms: clean
rm -rf /usr/src/$(MODULE_NAME)-$(MODULE_VER)
mkdir /usr/src/$(MODULE_NAME)-$(MODULE_VER) -p
cp . /usr/src/$(MODULE_NAME)-$(MODULE_VER) -a
rm -rf /usr/src/$(MODULE_NAME)-$(MODULE_VER)/.hg
$(REMOVE_MODULE)
dkms add -m $(MODULE_NAME) -v $(MODULE_VER)
dkms build -m $(MODULE_NAME) -v $(MODULE_VER)
dkms install -m $(MODULE_NAME) -v $(MODULE_VER) --force