-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
60 lines (49 loc) · 1.38 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
#
#
#
CONFIG_CTAP_SHORT = ON
ifneq ($(KERNELRELEASE),)
obj-m := r8152.o
# EXTRA_CFLAGS += -DRTL8152_S5_WOL
# EXTRA_CFLAGS += -DRTL8152_DEBUG
ifneq (,$(filter OFF off, $(CONFIG_CTAP_SHORT)))
EXTRA_CFLAGS += -DCONFIG_CTAP_SHORT_OFF
endif
ifeq (TRUE, $(shell test $(VERSION) -lt 5 && echo "TRUE" || \
test $(VERSION) -eq 5 && test $(PATCHLEVEL) -lt 12 && echo "TRUE"))
EXTRA_CFLAGS += -DLINUX_VERSION_MAJOR=$(VERSION)
EXTRA_CFLAGS += -DLINUX_VERSION_PATCHLEVEL=$(PATCHLEVEL)
EXTRA_CFLAGS += -DLINUX_VERSION_SUBLEVEL=$(SUBLEVEL)
endif
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD :=$(shell pwd)
TARGET_PATH := kernel/drivers/net/usb
INBOXDRIVER := $(shell find $(subst build,$(TARGET_PATH),$(KERNELDIR)) -name r8152.ko.* -type f)
RULEFILE = 50-usb-realtek-net.rules
RULEDIR = /etc/udev/rules.d/
.PHONY: modules
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
.PHONY: all
all: clean modules install
.PHONY: clean
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
.PHONY: install
install:
ifneq ($(shell lsmod | grep r8153_ecm),)
rmmod r8153_ecm
endif
ifneq ($(shell lsmod | grep r8152),)
rmmod r8152
endif
ifneq ($(INBOXDRIVER),)
rm -f $(INBOXDRIVER)
endif
$(MAKE) -C $(KERNELDIR) M=$(PWD) INSTALL_MOD_DIR=$(TARGET_PATH) modules_install
modprobe r8152
.PHONY: install_rules
install_rules:
install --group=root --owner=root --mode=0644 $(RULEFILE) $(RULEDIR)
endif