summaryrefslogtreecommitdiffstats
path: root/firmware/tests/Makefile
blob: 1aa3fe6a553ff5162a853cefb264ac7088c414b9 (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
CPPFLAGS	:= -I.. -Ifake -DF_CPU=8000000UL \
		   -DTESTSUITE=1
CFLAGS		:= -std=c11 -g -O2 -Wall -Wextra -Wno-unused-parameter -Wswitch-enum \
		   -Wsuggest-attribute=noreturn -Wundef -Wpointer-arith \
		   -Wcast-qual -Wlogical-op -Wshadow -Wconversion
LDFLAGS		:=

TESTS		:= test_common \
		   test_fixpt \
		   test_pid \
		   test_scale \
		   test_timer

TEST_BINS	:= $(foreach t,$(TESTS),$(t).run)

%.o: %.c test.h
	$(CC) -o $@ -c $(CPPFLAGS) $(CFLAGS) $<

test_%.run: test_%.o fake/fake.o
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $(LDFLAGS) $^

all: $(TEST_BINS)
	./test_common.run
	./test_timer.run
	./test_fixpt.run
	./test_pid.run
	./test_scale.run
	@echo
	@echo "All test succeeded"

clean:
	rm -f *.o
	rm -f fake/*.o
	rm -f $(TEST_BINS)

.PHONY: all clean
bues.ch cgit interface