|
@@ -1,47 +1,47 @@
|
|
| 1 |
-
APPNAME=
|
| 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)
|
| 1 |
+
APPNAME=hello_iw_shr
|
| 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)
|