forked from sysprog21/fibdrv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (32 loc) · 804 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
CONFIG_MODULE_SIG = n
TARGET_MODULE := fibdrv
obj-m := $(TARGET_MODULE).o
ccflags-y := -std=gnu99 -Wno-declaration-after-statement
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
GIT_HOOKS := .git/hooks/applied
all: $(GIT_HOOKS) client
$(MAKE) -C $(KDIR) M=$(PWD) modules
$(GIT_HOOKS):
@scripts/install-git-hooks
@echo
clean:
$(MAKE) -C $(KDIR) M=$(PWD) clean
$(RM) client out
load:
sudo insmod $(TARGET_MODULE).ko
unload:
sudo rmmod $(TARGET_MODULE) || true >/dev/null
client: client.c
$(CC) -o $@ $^
PRINTF = env printf
PASS_COLOR = \e[32;01m
NO_COLOR = \e[0m
pass = $(PRINTF) "$(PASS_COLOR)$1 Passed [-]$(NO_COLOR)\n"
check: all
$(MAKE) unload
$(MAKE) load
sudo ./client > out
$(MAKE) unload
@diff -u out scripts/expected.txt && $(call pass)
@scripts/verify.py