/
Makefile
49 lines (37 loc) · 1.24 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
# Targets for running a Dockerized testing environment
include ./makefiles/docker.mk
### Uncomment this to run Clang's static analyzer while building; this makes the build slower.
ANALYZER:=scan-build
### Uncomment this to do memory leak analysis while running; this makes tests run (slightly) slower
VALGRIND := valgrind -q --leak-check=full --show-leak-kinds=all --track-origins=yes --error-exitcode=42
### Uncomment this if you want to produce verbose debugging output during execution
DEBUG:=-DLOG_USE_COLOR
### Compiler settings
CC:=clang
CFLAGS :=-std=gnu11 -g -lm # NOTE: -v shows all paths Clang searches for headers
WARNINGS :=-Weverything -Werror
INCLUDES :=-I common/include
LIBS := common/src/*.c
COMPILE:=$(ANALYZER) $(CC) $(CFLAGS) $(WARNINGS) $(DEBUG) $(INCLUDES) $(LIBS)
### Binary cleanup
setup:
-mkdir bin
clean:
-rm -r bin/*
.PHONY: client server tests
client: clean
reset
-rm serialized_data.bin
$(COMPILE) -I $@/include/ $@/src/*.c -o bin/$@
$(VALGRIND) bin/$@
server: clean
reset
$(COMPILE) -I $@/include/ $@/src/*.c -o bin/$@
$(VALGRIND) ./bin/$@
tests: clean
reset
$(COMPILE) -I $@/include/ $@/log_test.c -o bin/log_test
$(VALGRIND) ./bin/log_test
tcpdump:
tcpdump -i lo -v -X -w capture.cap
shriek: clean client server