pthreads/{hello_w → hello_iw_pri}/Makefile RENAMED
@@ -1,41 +1,47 @@
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
1
+ APPNAME=hello_iw_pri
2
+ EXECUTABLES=$(APPNAME) $(APPNAME)_asan $(APPNAME)_msan $(APPNAME)_tsan $(APPNAME)_ubsan
3
 
4
+ CC=cc
5
+ CC2=clang
6
+ CFLAGS=-g -Wall -Wextra
7
+ LIBS=-pthread
8
 
9
+ all: $(EXECUTABLES)
 
10
 
11
+ $(APPNAME): $(APPNAME).c
12
+ $(CC) $(CFLAGS) $(APPNAME).c -o $(APPNAME) $(LIBS)
13
 
14
+ $(APPNAME)_asan: $(APPNAME).c
15
+ $(CC2) $(CFLAGS) -fsanitize=address $(APPNAME).c -o $(APPNAME)_asan $(LIBS)
16
 
17
+ $(APPNAME)_msan: $(APPNAME).c
18
+ $(CC2) $(CFLAGS) -fsanitize=memory $(APPNAME).c -o $(APPNAME)_msan $(LIBS)
19
 
20
+ $(APPNAME)_tsan: $(APPNAME).c
21
+ $(CC2) $(CFLAGS) -fsanitize=thread $(APPNAME).c -o $(APPNAME)_tsan $(LIBS)
22
+
23
+ $(APPNAME)_ubsan: $(APPNAME).c
24
+ $(CC2) $(CFLAGS) -fsanitize=undefined $(APPNAME).c -o $(APPNAME)_ubsan $(LIBS)
25
 
26
  .PHONY: memcheck
27
  memcheck:
28
+ valgrind ./$(APPNAME)
29
 
30
  .PHONY: helgrind
31
  helgrind:
32
+ valgrind --tool=helgrind --quiet ./$(APPNAME)
33
 
34
  .PHONY: rebuild
35
+ rebuild: clean $(APPNAME)
36
 
37
  .PHONY: lint
38
  lint:
39
+ cpplint --filter=-readability/casting $(APPNAME).c
40
 
41
  .PHONY: gitignore
42
  gitignore:
43
+ echo $(EXECUTABLES) | tr " " "\n" > .gitignore
44
 
45
  .PHONY: clean
46
  clean:
47
+ rm -rf $(EXECUTABLES)