commit b1b5ba5aa10a7afbf3bbac48b808ddaff057856e parent 22017b3362226e8c2e7943a7a999a39e8fc9f709 Author: keyle <keyle@capsule.org> Date: Thu, 14 May 2026 21:25:40 +1000 makefile wip tests Diffstat:
| M | makefile | | | 20 | +++++++++++++++++--- |
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/makefile b/makefile @@ -3,12 +3,14 @@ warn = -Wall -Wextra pedantic = -Wpedantic -Werror debug = -O1 -g release = -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong +fast = -O3 -ffast-math -DNDEBUG -march=native -mtune=native -flto -fomit-frame-pointer \ + -pipe -fno-trapping-math std = -std=c99 -Werror=declaration-after-statement sane = -fsanitize=address,undefined -fno-omit-frame-pointer cfiles = src/**.c includes = -i src/**.h -bin = sicc -out = -o $(bin) +BINARY = sicc +out = -o $(BINARY) export ASAN_OPTIONS := allocator_may_return_null=1 @@ -16,8 +18,20 @@ default: $(cmp) $(warn) $(std) $(debug) $(sane) $(out) $(cfiles) clean: - rm -rf $(bin) $(bin).* + rm -rf $(BINARY) $(BINARY).dSYM release: clean $(cmp) $(warn) $(pedantic) $(std) $(release) $(out) $(cfiles) +fast: + $(cmp) $(std) $(fast) $(out) $(cfiles) + +jobs ?= $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 16) + +test: clean fast + +@find . -mindepth 2 -maxdepth 3 -name '*.sic' -print0 \ + | xargs -0 -r -P$(jobs) -n1 sh -c 'printf "%s\n" "$$1" 1>&2; exec ./$(BINARY) --quiet "$$1" >/dev/null' sh + +test-slow: clean fast + +@find . -maxdepth 1 -name '*.sic' -print0 \ + | xargs -0 -r -P1 -n1 sh -c 'printf "%s\n" "$$1" 1>&2; exec ./$(BINARY) --quiet "$$1" >/dev/null' sh