makefile (1193B)
lzcmp = clang
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
BINARY = sicc
out = -o $(BINARY)
export ASAN_OPTIONS := allocator_may_return_null=1
default:
$(cmp) $(warn) $(std) $(debug) $(sane) $(out) $(cfiles)
clean:
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 . -mindepth 2 -maxdepth 3 -name '*.sic' -print0 \
| xargs -0 -r -P1 -n1 sh -c 'printf "%s\n" "$$1" 1>&2; exec ./$(BINARY) --quiet "$$1" >/dev/null' sh