forked from sysprog21/fibdrv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (37 loc) · 986 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
42
43
44
45
46
47
48
CONFIG_MODULE_SIG = n
TARGET_MODULE := fibdrv
obj-m := $(TARGET_MODULE).o
$(TARGET_MODULE)-objs := src/fibdrv.o src/bignum.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 measure
$(MAKE) -C $(KDIR) M=$(PWD) modules
$(GIT_HOOKS):
@scripts/install-git-hooks
@echo
clean:
$(MAKE) -C $(KDIR) M=$(PWD) clean
$(RM) client out measure
load:
sudo insmod $(TARGET_MODULE).ko
unload:
sudo rmmod $(TARGET_MODULE) || true >/dev/null
client: utils/client.c
$(CC) -O2 -o $@ $^
measure: utils/measure.c
$(CC) -O2 -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
verify: check
@exit $$(scripts/verify.py | grep -c fail)