-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathMakefile
More file actions
164 lines (135 loc) · 5.1 KB
/
Copy pathMakefile
File metadata and controls
164 lines (135 loc) · 5.1 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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
CORE_OBJ=\
lib/chooser.o\
lib/nanorq_core.o\
lib/ops.o\
lib/params.o\
lib/partition.o\
lib/sopi.o\
lib/precode.o\
lib/rand.o\
lib/tuple.o\
lib/uvec.o\
deps/obl/oblas_common.o\
deps/obl/oblas_lite.o
OBJ=\
lib/io.o\
lib/nanorq.o\
$(CORE_OBJ)
TEST_UTILS=\
t/00util/matgen\
t/00util/repgen\
t/00util/hdpcgen\
t/00util/precond\
t/00util/ult\
t/00util/schedgen\
t/00util/test_utils\
t/00util/api_regress
EXAMPLES=\
examples/encode\
examples/decode\
examples/carousel\
examples/tsnc_multipath\
examples/tsnc_sync\
examples/blockchain_gossip
CPPFLAGS = -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64
CFLAGS = -O3 -g -std=c11 -Wall -I. -Iinclude -Ideps/
CFLAGS += -march=native -funroll-loops -ftree-vectorize -fstack-protector-strong -Wno-unused -Wno-sequence-point
all: test libnanorq.a libnanorq_core.a $(EXAMPLES)
test: encode decode
$(MAKE) -f example.make
encode: encode.o libnanorq.a
decode: decode.o libnanorq.a
benchmark: benchmark.o $(OBJ)
benchmark_core: benchmark_core.o $(CORE_OBJ)
t/00util/matgen: t/00util/matgen.o $(CORE_OBJ)
t/00util/repgen: t/00util/repgen.o $(CORE_OBJ)
t/00util/hdpcgen: t/00util/hdpcgen.o $(CORE_OBJ)
t/00util/precond: t/00util/precond.o $(CORE_OBJ)
t/00util/ult: t/00util/ult.o $(CORE_OBJ)
t/00util/schedgen: t/00util/schedgen.o $(CORE_OBJ)
t/00util/test_utils: t/00util/test_utils.o $(CORE_OBJ)
t/00util/api_regress: t/00util/api_regress.o $(OBJ)
examples/encode: examples/encode.o $(OBJ)
examples/decode: examples/decode.o $(OBJ)
examples/carousel: examples/carousel.o $(OBJ)
examples/tsnc_multipath: examples/tsnc_multipath.o $(OBJ)
examples/tsnc_sync: examples/tsnc_sync.o $(OBJ)
examples/blockchain_gossip: examples/blockchain_gossip.o $(OBJ)
check: clean $(TEST_UTILS) $(EXAMPLES)
prove -I. -v t/*.t
check-nolibc: clean
$(MAKE) libnanorq_core.a CPPFLAGS="$(CPPFLAGS) -DNANORQ_NO_LIBC"
$(MAKE) $(TEST_UTILS)
prove -I. -v t/10pcmat.t t/20repmat.t t/30precond.t t/35ult.t t/40hdpc.t t/50schedules.t
libnanorq.a: $(OBJ)
$(AR) rcs $@ $(OBJ)
libnanorq_core.a: $(CORE_OBJ)
$(AR) rcs $@ $(CORE_OBJ)
clean:
$(RM) encode decode lib/*.o deps/obl/*.o *.o *.a *.gcda *.gcno *.gcov callgrind.* *.gperf *.prof *.heap perf.data perf.data.old benchmark benchmark_core $(TEST_UTILS) $(EXAMPLES)
find . -name '*.[a,o]' | xargs $(RM)
indent:
clang-format -style=LLVM -i lib/*.c include/*.h examples/*.c t/00util/*.c benchmark.c benchmark_core.c
scan:
scan-build --status-bugs $(MAKE) clean benchmark
gcov: CFLAGS += -O0 -fprofile-arcs -ftest-coverage
gcov: LDLIBS = -lgcov --coverage
gcov: clean benchmark
./benchmark 1280 1000 5.0
perf: clean benchmark
perf record -g ./benchmark 1280 50000 5.0
pprof -svg ./benchmark perf.data > perf.svg
gperf: LDLIBS += -lprofiler
gperf: clean benchmark
CPUPROFILE=benchmark.prof ./benchmark 1280 50000 5.0
pprof -svg ./benchmark benchmark.prof > gperf.svg
ubsan: CC=clang
ubsan: CFLAGS += -fsanitize=address,undefined
ubsan: LDFLAGS += -fsanitize=address,undefined
ubsan: clean benchmark t/00util/api_regress examples/tsnc_sync examples/tsnc_multipath examples/blockchain_gossip
./benchmark 1280 50000 0
./t/00util/api_regress
./examples/tsnc_sync
./examples/tsnc_multipath
./examples/blockchain_gossip
bench: benchmark
@echo "K encode precalc decode decode-oh5"
@./benchmark 1280 100 5.0
@./benchmark 1280 500 5.0
@./benchmark 1280 1000 5.0
@./benchmark 1280 5000 5.0
@./benchmark 1280 10000 5.0
@./benchmark 1280 50000 5.0
bench-core: benchmark_core
@echo "K encode precalc decode decode-oh5"
@./benchmark_core 1280 100 5.0
@./benchmark_core 1280 500 5.0
@./benchmark_core 1280 1000 5.0
@./benchmark_core 1280 5000 5.0
@./benchmark_core 1280 10000 5.0
@./benchmark_core 1280 50000 5.0
check-embedded:
$(MAKE) clean
$(MAKE) libnanorq_core.a CPPFLAGS="$(CPPFLAGS) -DNANORQ_NO_LIBC"
@echo "--- Undefined symbols in libnanorq_core.a ---"
@if nm -u libnanorq_core.a | grep -E '\b(malloc|calloc|realloc|free|posix_memalign|__assert_fail)\b'; then \
echo "FAIL: libc symbols found in embedded build"; exit 1; \
else \
echo "PASS: no libc allocator/assert symbols found"; \
fi
valgrind: CPPFLAGS=-Wall -Iinclude -Ideps/ -fPIC
valgrind: CFLAGS = -O0 -g -std=c11
valgrind: clean $(TEST_UTILS) $(EXAMPLES)
valgrind --leak-check=full --errors-for-leak-kinds=definite --error-exitcode=2 ./t/00util/api_regress
valgrind --leak-check=full --errors-for-leak-kinds=definite --error-exitcode=2 ./examples/tsnc_sync > /dev/null
valgrind --leak-check=full --errors-for-leak-kinds=definite --error-exitcode=2 ./examples/tsnc_multipath > /dev/null
valgrind --leak-check=full --errors-for-leak-kinds=definite --error-exitcode=2 ./examples/blockchain_gossip > /dev/null
valgrind --error-exitcode=2 ./t/00util/hdpcgen 500 > /dev/null
valgrind --error-exitcode=2 ./t/00util/matgen 500 > /dev/null
valgrind --error-exitcode=2 ./t/00util/precond 500 > /dev/null
valgrind --error-exitcode=2 ./t/00util/repgen 500 > /dev/null
valgrind --error-exitcode=2 ./t/00util/ult 500 > /dev/null
valgrind --error-exitcode=2 ./t/00util/schedgen 500 > /dev/null
valgrind --error-exitcode=2 ./examples/encode 500 64 10 t/assets/sample_data/raw > /dev/null
check-interop:
./t/interop_harness.sh