aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLion Kortlepel <[email protected]>2026-01-22 23:18:16 +0100
committerLion Kortlepel <[email protected]>2026-01-22 23:18:16 +0100
commit2d2be7e2b38031f7cd826f78543b18a287423ad7 (patch)
tree2bf0eba1995000e8d95cffae4101486541ce6eeb /Makefile
parent36fdeca43eab4439a117d4c912f87e704eaa9cd5 (diff)
downloadargs-2d2be7e2b38031f7cd826f78543b18a287423ad7.tar.zst
args-2d2be7e2b38031f7cd826f78543b18a287423ad7.zip
fix!: reach 96% line coverage, add tests, fix bugs
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 14 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 9381484..28834f2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,28 @@
# CAUTION: This Makefile builds ONLY the tests.
# To use this library, see ls_test.h or README.md.
+CFLAGS ?= -fsanitize=address,undefined
+CFLAGS += -I.
+
+all: tests/tests examples/basic_example
+
tests/tests: ls_args.o tests/tests.c tests/ls_test.h
- $(CC) -o $@ ls_args.o tests/tests.c -Itests -I. -ggdb
+ $(CC) -o $@ ls_args.o tests/tests.c -Itests -ggdb $(CFLAGS)
# Usually you wouldn't do this, but for tests we want this compiled with the
# most pedantic settings.
# Dont use this.
ls_args.o: ls_args.h
- $(CC) -c -x c -o $@ $^ -Wall -Wextra -Wpedantic -Werror -std=c89 -ggdb \
+ echo -e "#include <stddef.h>\nvoid* test_realloc(void*, size_t);" >.test.h
+ cat .test.h ls_args.h >.ls_args_test.c
+ rm .test.h
+ $(CC) -c -x c -o $@ .ls_args_test.c -Wall -Wextra -Wpedantic -Werror -std=c89 -ggdb \
-Wno-error=pragma-once-outside-header \
- -I. \
-DLS_ARGS_IMPLEMENTATION \
- -Wno-pragma-once-outside-header
+ -DLS_REALLOC=test_realloc \
+ -Wno-pragma-once-outside-header \
+ $(CFLAGS)
+ rm .ls_args_test.c
.PHONY: clean