aboutsummaryrefslogtreecommitdiff
path: root/tests/Makefile
blob: 2b87d44bb6d8955254c7b7046ef433c0e639b024 (plain)
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
CFLAGS?= -std=c11 -D_GNU_SOURCE -Wall -pedantic -Werror -Wfloat-equal	\
-Wundef -Wcast-align -Wwrite-strings -Waggregate-return			\
-Wswitch-default -Wconversion -Wno-error=sign-conversion		\
-Wunreachable-code -Wno-aggregate-return -I..
LDFLAGS?= -lm -latomic
TARG = tests
CC = gcc
INCS = ../common.h ../std.h ../analyze.h sut.h expected.h

ifeq (${DEBUG},1)
	CFLAGS+= -fsanitize=undefined -g3 -DDEBUG
endif
ifeq (${ASAN},1)
	CFLAGS+= -fsanitize=address
endif
ifeq (${TSAN},1)
	CFLAGS+= -fsanitize=thread
endif

.PHONY: all clean

all: $(TARG)

$(TARG): $(TARG).c $(INCS)
	$(CC) $(CFLAGS) $(LDFLAGS) -I.. -o $@ $<

check: $(TARG)
	./$(TARG)

clean:
	rm -f $(TARG)