1- .PHONY : test example
1+ .PHONY : test sanitize example
22
33# Detect linux and define _DEFAULT_SOURCE if so
44UNAME_S := $(shell uname -s)
@@ -7,6 +7,7 @@ ifeq ($(UNAME_S),Linux)
77endif
88
99CLANG_FLAGS := -xc -Wall -Wextra -Wpedantic -O3 -g -std=c99 $(EXTRA_CFLAGS )
10+ SANITIZE_FLAGS := -xc -Wall -Wextra -Wpedantic -O1 -g -std=c99 -fno-omit-frame-pointer -fsanitize=address,undefined $(EXTRA_CFLAGS )
1011
1112out/test_runner : ffc.h test_src/test.c | out
1213 gcc -xc -Wall -Wextra -Wpedantic ffc.h -fsyntax-only
@@ -16,9 +17,19 @@ test: out/test_runner out/test_int_runner
1617 ./out/test_runner
1718 ./out/test_int_runner
1819
20+ sanitize : out/test_runner_sanitize out/test_int_runner_sanitize
21+ ./out/test_runner_sanitize
22+ ./out/test_int_runner_sanitize
23+
1924out/test_int_runner : ffc.h test_src/test_int.c | out
2025 clang $(CLANG_FLAGS ) -I. -Itest_src test_src/test_int.c -o out/test_int_runner -lm
2126
27+ out/test_runner_sanitize : ffc.h test_src/test.c | out
28+ clang $(SANITIZE_FLAGS ) -I. -Itest_src test_src/test.c -o out/test_runner_sanitize -lm
29+
30+ out/test_int_runner_sanitize : ffc.h test_src/test_int.c | out
31+ clang $(SANITIZE_FLAGS ) -I. -Itest_src test_src/test_int.c -o out/test_int_runner_sanitize -lm
32+
2233ffc.h : src/ffc.h src/common.h src/parse.h src/digit_comparison.h src/api.h src/bigint.h amalgamate.py
2334 python3 amalgamate.py > ffc.h
2435
@@ -30,4 +41,3 @@ example: out/example
3041
3142out :
3243 mkdir -p out
33-
0 commit comments