summaryrefslogtreecommitdiff
path: root/test/Makefile
blob: 6bdec12ec3ae42af1e4592ac82f3793f3c6c7335 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
SRCS        := $(wildcard *_test.c)
OBJS        := $(patsubst %_test.c, %_test.o, $(SRCS))
CFLAGS      := -I../src
TESTS       := $(patsubst %_test.c, %_test, $(SRCS))
EXEC_TESTS  := $(patsubst %_test, ./%_test, $(TESTS))

.PHONY: all
all: munit.o $(TESTS)
	@for file in $(EXEC_TESTS); do \
		./"$$file"; \
	done

.PHONY: clean
clean:
	$(RM) *.o *_test

.PHONY: linter
linter: $(SRCS)
	clang-format --dry-run --Werror $?

.PHONY: linter-fix
linter-fix: $(SRCS)
	clang-format -i $?

string_view_test: munit.o ../build/string_view.o string_view_test.o
	$(CC) $? $(CFLAGS) -o $@

vector_test: munit.o ../build/vector.o vector_test.o
	$(CC) $? $(CFLAGS) -o $@

list_test: munit.o ../build/list.o list_test.o
	$(CC) $? $(CFLAGS) -o $@

lexer_test: munit.o ../build/string_view.o ../build/lexer.o lexer_test.o
	$(CC) $? $(CFLAGS) -o $@

parser_test: munit.o ../build/string_view.o ../build/scope.o ../build/vector.o ../build/lexer.o ../build/ast.o ../build/parser.o parser_test.o
	$(CC) $? $(CFLAGS) -o $@

scope_test: munit.o ../build/string_view.o ../build/vector.o ../build/ast.o ../build/scope.o scope_test.o
	$(CC) $? $(CFLAGS) -o $@

integration_test: munit.o integration_test.o
	$(CC) $? $(CFLAGS) -o $@