#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