-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (48 loc) · 1.56 KB
/
Copy pathMakefile
File metadata and controls
65 lines (48 loc) · 1.56 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# SPDX-License-Identifier: GPL-2.0-only
# Top-level build orchestration.
#
# make build everything
# make module build kernel/krw.ko
# make client build the memflow-krw crate
# make tests build the C correctness tests
# make bench build the C benchmarks
# make check fmt + clippy on the crate
# make vm build everything and run the suite in a throwaway VM
# make clean remove build products
#
# Nothing here loads the module. Use `make vm`; see README.
CC ?= cc
CFLAGS ?= -O2 -Wall -Wextra
KDIR ?= /lib/modules/$(shell uname -r)/build
TESTS := tests/test_krw tests/test_cow tests/helper
BENCH := bench/baseline bench/bench_krw
.PHONY: all module client tests bench check vm clean
all: module client tests bench
module:
$(MAKE) -C kernel KDIR=$(KDIR)
client:
cargo build --release
tests: $(TESTS)
bench: $(BENCH)
# Statically linked: the VM runs these against a rootfs we don't control.
tests/% bench/%: %.c
$(CC) $(CFLAGS) -static -o $@ $<
tests/test_krw: tests/test_krw.c include/krw.h
$(CC) $(CFLAGS) -static -o $@ $<
tests/test_cow: tests/test_cow.c include/krw.h
$(CC) $(CFLAGS) -static -o $@ $<
tests/helper: tests/helper.c
$(CC) $(CFLAGS) -static -o $@ $<
bench/baseline: bench/baseline.c
$(CC) $(CFLAGS) -static -o $@ $<
bench/bench_krw: bench/bench_krw.c include/krw.h
$(CC) $(CFLAGS) -static -o $@ $<
check:
cargo fmt --all -- --check
cargo clippy --release --all-targets -- -D warnings
vm:
./vm/run.sh
clean:
$(MAKE) -C kernel KDIR=$(KDIR) clean
cargo clean
rm -f $(TESTS) $(BENCH)