-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
40 lines (31 loc) · 1.22 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
DEBUG = n
ONE_PIPE = n
IPC = 0 # 0 == netlink, 1 == chardev
# Add your debugging flag (or not) to EXTRA_CFLAGS
ifeq ($(DEBUG),y)
DEBFLAGS = -O1 -g -D__DEBUG__ -D__LOG_DEBUG__ # "-O" is needed to expand inlines
else
DEBFLAGS = -Ofast
endif
KERNEL_VERSION_MAJOR := $(shell uname -r | awk -F '.' '{print $$1}')
KERNEL_VERSION_MINOR := $(shell uname -r | awk -F '.' '{print $$2}')
EXTRA_CFLAGS += -D__KERNEL_VERSION_MAJOR__=$(KERNEL_VERSION_MAJOR)
EXTRA_CFLAGS += -D__KERNEL_VERSION_MINOR__=$(KERNEL_VERSION_MINOR)
EXTRA_CFLAGS += -D__IPC__=$(IPC)
ifeq ($(ONE_PIPE),y)
DEBFLAGS += -DONE_PIPE
endif
EXTRA_CFLAGS += $(DEBFLAGS)
EXTRA_CFLAGS += -std=gnu99 -Wno-declaration-after-statement -fgnu89-inline -D__KERNEL__
TARGET = ccp
ccp-objs := libccp/serialize.o libccp/ccp_priv.o libccp/machine.o libccp/ccp.o ccpkp/ccpkp.o ccpkp/lfq/lfq.o tcp_ccp.o ccp_nl.o
obj-m := $(TARGET).o
all:
ifneq ($(shell expr $(KERNEL_VERSION_MAJOR) \>= 4),1)
$(error "Only kernel version >= 4 is supported: $(KERNEL_VERSION_MAJOR) $(KERNEL_VERSION_MINOR)")
endif
ifeq ($(shell expr $(KERNEL_VERSION_MINOR) \>= 4),1)
endif
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) modules
clean:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) clean