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 | EXE=hello_w
all: $(EXE) $(EXE)_asan $(EXE)_msan $(EXE)_tsan $(EXE)_ubsan
$(EXE): hello_w.c
cc -g -Wall -Wextra hello_w.c -o $(EXE) -pthread
$(EXE)_asan: hello_w.c
clang -g -Wall -Wextra -fsanitize=address hello_w.c -o $(EXE)_asan -pthread
$(EXE)_msan: hello_w.c
clang -g -Wall -Wextra -fsanitize=memory hello_w.c -o $(EXE)_msan -pthread
$(EXE)_tsan: hello_w.c
clang -g -Wall -Wextra -fsanitize=thread hello_w.c -o $(EXE)_tsan -pthread
$(EXE)_ubsan: hello_w.c
clang -g -Wall -Wextra -fsanitize=undefined hello_w.c -o $(EXE)_ubsan -pthread
.PHONY: memcheck
memcheck:
valgrind ./$(EXE)
.PHONY: helgrind
helgrind:
valgrind --tool=helgrind --quiet ./$(EXE)
.PHONY: rebuild
rebuild: clean $(EXE)
.PHONY: lint
lint:
cpplint --filter=-readability/casting hello_w.c
.PHONY: gitignore
gitignore:
echo $(EXE) $(EXE)_asan $(EXE)_msan $(EXE)_tsan $(EXE)_ubsan | tr " " "\n" > .gitignore
.PHONY: clean
clean:
rm -rf $(EXE) $(EXE)_asan $(EXE)_msan $(EXE)_tsan $(EXE)_ubsan
|