forked from CentaurusInfra/mizar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
129 lines (104 loc) · 2.91 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# SPDX-License-Identifier: GPL-2.0-or-later
modules := src test teste2e mizar
build := build
CC = gcc
ARCH := $(shell uname -m)
# Sanitizer
SANITIZE.aarch64 :=
SANITIZE += $(SANITIZE.$(ARCH))
SANITIZE += -fsanitize=leak
SANITIZE += -fsanitize=undefined
SANITIZE += -fsanitize=shift
SANITIZE += -fsanitize=integer-divide-by-zero
SANITIZE += -fsanitize=unreachable
SANITIZE += -fsanitize=vla-bound
SANITIZE += -fsanitize=null
SANITIZE += -fsanitize=return
SANITIZE += -fsanitize=signed-integer-overflow
SANITIZE += -fsanitize=bounds
SANITIZE += -fsanitize=alignment
SANITIZE += -fsanitize=object-size
SANITIZE += -fsanitize=float-divide-by-zero
SANITIZE += -fsanitize=float-cast-overflow
SANITIZE += -fsanitize=nonnull-attribute
SANITIZE += -fsanitize=returns-nonnull-attribute
SANITIZE += -fsanitize=bool
SANITIZE += -fsanitize=enum
SANITIZE += -fsanitize=vptr
SANITIZE += -fno-omit-frame-pointer
## CFLAGS
CFLAGS += -I.
CFLAGS += -Ilib/usr/include
CFLAGS += -g -O3 -DDEBUG -Llib
CFLAGS += -std=c11
CFLAGS += -D_POSIX_C_SOURCE
CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -Werror
CFLAGS += -pedantic -Wpedantic
CLFAGS += -Wno-cast-function-type -Wno-error=cast-function-type
CFLAGS += -fno-common
CFLAGS += -fstrict-aliasing
CFLAGS += $(SANITIZE)
## LDFLAGS
LDFLAGS.x86_64 += -Llib/usr/lib64
LDFLAGS.aarch64 += -Llib/usr/lib
LDFLAGS += $(LDFLAGS.$(ARCH))
LDFLAGS += -l:libbpf.a
LDFLAGS += -l:libelf.a
LDFLAGS += -lz
LDFLAGS += -lnsl
LDFLAGS += -static-liblsan
LDFLAGS += -static-libubsan
$(info LDFLAGS=$(LDFLAGS))
LLC=llc-7 -march=bpf -filetype=obj
CLANG=clang-7
CLANGFLAGS= -I.\
-Wno-unused-value -Wno-pointer-sign\
-Wno-compare-distinct-pointer-types \
-Wno-gnu-variable-sized-type-not-at-end \
-Wno-address-of-packed-member -Wno-tautological-compare \
-Wno-unknown-warning-option -O3 -emit-llvm -c -o -
CLANGFLAGS_DEBUG:= -DDEBUG -D__KERNEL__ -g -D__BPF_TRACING__ $(CLANGFLAGS)
#all: rpcgen transit transitd xdp
all:: dirmake update_modules libbpf
.PHONY: update_modules
update_modules:
git submodule update --init --recursive
install:
cp build/bin/* /usr/bin
ln -s /home/ubuntu/mizar/build/xdp /trn_xdp
ln -s /sys/fs/bpf /bpffs
-include $(patsubst %, %/module.mk, $(modules))
.PHONY: clean
clean::
rm -f cov/*
rm -rf lcov/*
rm -rf build/bin/*
rm -rf build/tests/*
rm -f *.gcov
.PHONY: test
test:: lcov functest
.PHONY: unittest
unittest::
.PHONY:
gcov: run_unittests
GCOV_PREFIX=cov; gcov $(clisrc)
GCOV_PREFIX=cov; gcov $(dmnsrc)
.PHONY: lcov
lcov:gcov
lcov -d . -b . -c -o lcov/transit_cov.info
lcov --remove lcov/transit_cov.info '/usr/*' '*src/rpcgen/*' '*src/extern/*' -o lcov/transit_cov_filtered.info
genhtml lcov/transit_cov_filtered.info -o lcov/report
@echo "see lcov/report/index.html"
.PHONY: mgmt_tests
mizar::
dirmake:
mkdir -p core
mkdir -p cov
mkdir -p lcov/report
mkdir -p build/bin
mkdir -p build/tests
mkdir -p build/xdp
mkdir -p test/trn_func_tests/output
mkdir -p test/trn_perf_tests/output