pthreads/{hello → hello_w}/Makefile RENAMED
@@ -1,42 +1,41 @@
1
- #target: prerrequisites
2
- # command to build target
3
 
4
- all: hello hello_asan hello_msan hello_tsan hello_ubsan
5
 
6
- hello: hello.c
7
- cc -g -Wall -Wextra hello.c -o hello -pthread
8
 
9
- hello_asan: hello.c
10
- clang -g -Wall -Wextra -fsanitize=address hello.c -o hello_asan -pthread
11
 
12
- hello_msan: hello.c
13
- clang -g -Wall -Wextra -fsanitize=memory hello.c -o hello_msan -pthread
14
 
15
- hello_tsan: hello.c
16
- clang -g -Wall -Wextra -fsanitize=thread hello.c -o hello_tsan -pthread
17
 
18
- hello_ubsan: hello.c
19
- clang -g -Wall -Wextra -fsanitize=undefined hello.c -o hello_ubsan -pthread
20
 
21
  .PHONY: memcheck
22
  memcheck:
23
- valgrind ./hello
24
 
25
  .PHONY: helgrind
26
  helgrind:
27
- valgrind --tool=helgrind --quiet ./hello
28
 
29
  .PHONY: rebuild
30
- rebuild: clean hello
31
 
32
  .PHONY: lint
33
  lint:
34
- cpplint --filter=-readability/casting hello.c
35
 
36
  .PHONY: gitignore
37
  gitignore:
38
- echo hello hello_asan hello_msan hello_tsan hello_ubsan | tr " " "\n" > .gitignore
39
 
40
  .PHONY: clean
41
  clean:
42
- rm -rf hello hello_asan hello_msan hello_tsan hello_ubsan
1
+ EXE=hello_w
 
2
 
3
+ all: $(EXE) $(EXE)_asan $(EXE)_msan $(EXE)_tsan $(EXE)_ubsan
4
 
5
+ $(EXE): hello_w.c
6
+ cc -g -Wall -Wextra hello_w.c -o $(EXE) -pthread
7
 
8
+ $(EXE)_asan: hello_w.c
9
+ clang -g -Wall -Wextra -fsanitize=address hello_w.c -o $(EXE)_asan -pthread
10
 
11
+ $(EXE)_msan: hello_w.c
12
+ clang -g -Wall -Wextra -fsanitize=memory hello_w.c -o $(EXE)_msan -pthread
13
 
14
+ $(EXE)_tsan: hello_w.c
15
+ clang -g -Wall -Wextra -fsanitize=thread hello_w.c -o $(EXE)_tsan -pthread
16
 
17
+ $(EXE)_ubsan: hello_w.c
18
+ clang -g -Wall -Wextra -fsanitize=undefined hello_w.c -o $(EXE)_ubsan -pthread
19
 
20
  .PHONY: memcheck
21
  memcheck:
22
+ valgrind ./$(EXE)
23
 
24
  .PHONY: helgrind
25
  helgrind:
26
+ valgrind --tool=helgrind --quiet ./$(EXE)
27
 
28
  .PHONY: rebuild
29
+ rebuild: clean $(EXE)
30
 
31
  .PHONY: lint
32
  lint:
33
+ cpplint --filter=-readability/casting hello_w.c
34
 
35
  .PHONY: gitignore
36
  gitignore:
37
+ echo $(EXE) $(EXE)_asan $(EXE)_msan $(EXE)_tsan $(EXE)_ubsan | tr " " "\n" > .gitignore
38
 
39
  .PHONY: clean
40
  clean:
41
+ rm -rf $(EXE) $(EXE)_asan $(EXE)_msan $(EXE)_tsan $(EXE)_ubsan