made a discovery of some kind of fuckup

This commit is contained in:
2026-05-05 23:05:53 +02:00
parent 5dcddd3474
commit d0d98170ea
9 changed files with 105 additions and 43 deletions
+30 -12
View File
@@ -1,33 +1,51 @@
CC := "zig cc"
CC := "cc"
CFLAGS := "-pedantic -Wall -Wextra -Wno-override-init -O0 -g -fno-omit-frame-pointer -fno-inline"
LDFLAGS := "-lcriterion"
LDFLAGS := if os() == "macos" {
"$(pkg-config --libs --cflags criterion)"
} else {
"-lcriterion"
}
TESTBIN := "/tmp/all_tests"
set shell := ["bash", "-cu"]
FOOBAR := "foobar"
FOOBAR_SOURCE := FOOBAR+".c"
FOOBAR_EXPANDED := FOOBAR+"-expanded.c"
run_foobar: build_foobar
./{{FOOBAR}}
build_foobar:
{{CC}} ./foobar.c -o {{FOOBAR}} {{CFLAGS}}
build_foobar: foobar_expanded
{{CC}} {{FOOBAR_EXPANDED}} -o {{FOOBAR}} {{CFLAGS}}
foobar_expanded:
{{CC}} -P -E {{FOOBAR_SOURCE}} -o {{FOOBAR_EXPANDED}}
clang-format -i {{FOOBAR_EXPANDED}}
clean_foobar:
rm {{FOOBAR}}
[default]
test: build
{{TESTBIN}}
{{TESTBIN}}
test_memcheck: build
valgrind --leak-check=full \
--show-leak-kinds=all \
--trace-children=yes \
--error-exitcode=1 \
{{TESTBIN}}
valgrind --leak-check=full \
--show-leak-kinds=all \
--trace-children=yes \
--error-exitcode=1 \
{{TESTBIN}}
build:
find "$PWD" -type f -name 'test*.c' | xargs -r {{CC}} {{CFLAGS}} _allocator_impl.c -o {{TESTBIN}} {{LDFLAGS}}
find . -type f -name 'test*.c' | xargs -r {{CC}} {{CFLAGS}} {{LDFLAGS}} _allocator_impl.c -o {{TESTBIN}}
DEPENDENCY_HEADERS := if os() == "macos" {
"$(pkg-config --cflags-only-I criterion | sed 's/-I//g')"
} else {
"TODO"
}
tag:
find "$PWD" -type f \( -name '*.c' -o -name '*.h' \) | xargs ctags
echo "Making tags from project and headers in {{DEPENDENCY_HEADERS}}"
ctags --languages=c --langmap=c:.c.h -R {{DEPENDENCY_HEADERS}} .