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 | #target: prerrequisites
# command to build target
all: hello hello_asan hello_msan hello_tsan hello_ubsan
hello: hello.c
cc -g -Wall -Wextra hello.c -o hello -pthread
hello_asan: hello.c
clang -g -Wall -Wextra -fsanitize=address hello.c -o hello_asan -pthread
hello_msan: hello.c
clang -g -Wall -Wextra -fsanitize=memory hello.c -o hello_msan -pthread
hello_tsan: hello.c
clang -g -Wall -Wextra -fsanitize=thread hello.c -o hello_tsan -pthread
hello_ubsan: hello.c
clang -g -Wall -Wextra -fsanitize=undefined hello.c -o hello_ubsan -pthread
.PHONY: memcheck
memcheck:
valgrind ./hello
.PHONY: helgrind
helgrind:
valgrind --tool=helgrind --quiet ./hello
.PHONY: rebuild
rebuild: clean hello
.PHONY: lint
lint:
cpplint --filter=-readability/casting hello.c
.PHONY: gitignore
gitignore:
echo hello hello_asan hello_msan hello_tsan hello_ubsan | tr " " "\n" > .gitignore
.PHONY: clean
clean:
rm -rf hello hello_asan hello_msan hello_tsan hello_ubsan
|