@@ -1,41 +1,47 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
4 |
|
5 |
-
$(
|
6 |
-
cc -g -Wall -Wextra hello_w.c -o $(EXE) -pthread
|
7 |
|
8 |
-
$(
|
9 |
-
|
10 |
|
11 |
-
$(
|
12 |
-
|
13 |
|
14 |
-
$(
|
15 |
-
|
16 |
|
17 |
-
$(
|
18 |
-
|
|
|
|
|
|
|
19 |
|
20 |
.PHONY: memcheck
|
21 |
memcheck:
|
22 |
-
valgrind ./$(
|
23 |
|
24 |
.PHONY: helgrind
|
25 |
helgrind:
|
26 |
-
valgrind --tool=helgrind --quiet ./$(
|
27 |
|
28 |
.PHONY: rebuild
|
29 |
-
rebuild: clean $(
|
30 |
|
31 |
.PHONY: lint
|
32 |
lint:
|
33 |
-
cpplint --filter=-readability/casting
|
34 |
|
35 |
.PHONY: gitignore
|
36 |
gitignore:
|
37 |
-
echo $(
|
38 |
|
39 |
.PHONY: clean
|
40 |
clean:
|
41 |
-
rm -rf $(
|
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)
|