-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
26 lines (20 loc) · 875 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
ifneq ($(KERNELRELEASE),)
obj-m := detectiontool.o
detectiontool-objs := src/main.o src/hook_syscalls.o src/hook_fops.o src/hook_networks.o src/detectmodules.o
HEADERS := $(PWD)/include
ccflags-y += -I$(HEADERS)
else
KERNELDIR ?=/lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
python_version_full := $(wordlist 2,4,$(subst ., ,$(shell python3 --version 2>&1)))
python_version_major := $(word 1,${python_version_full})
python_version_minor := $(word 2,${python_version_full})
all: kernel client
kernel:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
client: detectiontool.ko
gcc -fPIC src/client.c $$(python$(python_version_major).$(python_version_minor)-config --cflags) $$(python$(python_version_major).$(python_version_minor)-config --ldflags) -o client
endif
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
rm -rf *.ko *.mod.* *.o *.order *.symvers client