-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
85 lines (63 loc) · 2.89 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
build:
gcc -O3 -o server.out src/*.c src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c -lpthread
build_prometheus:
gcc -O3 -o server.out -DPROMETHEUS src/*.c src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c -lpthread
build_static:
gcc -O3 -o server.out -static src/*.c src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c -lpthread
build_prometheus_static:
gcc -O3 -o server.out -DPROMETHEUS -static src/*.c src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c -lpthread
build_benchmark:
gcc -O3 -o benchmark.out benchmarks/*.c benchmarks/*.h benchmarks/*/*.c src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c -lpthread
memcheck:
gcc -g -o memcheck.out src/*.c src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c -lpthread
valgrind --leak-check=full --show-leak-kinds=all ./memcheck.out -p 9090 -t -c
fuzztesting:
clang -g -fsanitize=address,undefined,fuzzer src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c fuzzTesting/parseRequest.c -lpthread
./a.out -jobs=5
memcheck_stats:
gcc -g -o memcheck.out -DPROMETHEUS src/*.c src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c -lpthread
valgrind --leak-check=full --show-leak-kinds=all ./memcheck.out -p 9090 -t -c
run_profile:
gcc -g -o profile.out src/*.c src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c -lpthread
valgrind --tool=callgrind --cache-sim=yes --branch-sim=yes --dump-instr=yes --collect-jumps=yes ./profile.out -p 9090 -t -ic
profile:
kcachegrind
rm_profile:
rm -rf *.out.*
run_debug:
make
./server.out -p 9090 -d
run_speedTest:
./test/raw_speedTest.sh | grep "Size\|Max\|Min\|Average"
./test/template_speedTest.sh | grep "Size\|Max\|Min\|Average"
docker:
docker build -t c-http-server:latest .
run_test: test.out
./test.out
rm test.out
test.out:
gcc -O3 \
test/main.c src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c -lpthread \
-o test.out
run_bench: bench.out
./bench.out
rm bench.out
json: bench.out
./bench.out --benchmark_format=json | tee benchmark_result.json
rm bench.out
bench.out: libs/benchmark/build/src/libbenchmark.a
g++ -O3 \
benchmarks/main.c src/webserver/*.h src/webserver/*/*.h src/webserver/*/*.c \
-std=c++11 -isystem ./libs/benchmark/include -L./libs/benchmark/build/src -lbenchmark -lpthread \
-Wno-write-strings \
-o bench.out
libs/benchmark/build/src/libbenchmark.a: libs/benchmark/build libs/benchmark/googletest
cd ./libs/benchmark/build && \
cmake -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_TESTING=true ../ && \
make -j
libs/benchmark/build: benchmark
mkdir -p libs/benchmark/build
benchmark:
[ -d libs/benchmark ] || git clone --depth=1 --single-branch --branch v1.5.0 https://github.com/google/benchmark.git libs/benchmark
libs/benchmark/googletest: benchmark
[ -d libs/benchmark/googletest ] || git clone --depth=1 --single-branch --branch release-1.10.0 https://github.com/google/googletest.git libs/benchmark/googletest