blob: 28834f2a229a477aa3bd89b012058509a108bf62 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# 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 -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
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 \
-DLS_ARGS_IMPLEMENTATION \
-DLS_REALLOC=test_realloc \
-Wno-pragma-once-outside-header \
$(CFLAGS)
rm .ls_args_test.c
.PHONY: clean
clean:
rm -f tests/tests
rm -f ls_args.o
|