summaryrefslogtreecommitdiff
path: root/n/avr/modules/math/fixed/test/Makefile
blob: 04aa4cff3ac49243824ba58e8c251631ff83789a (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
BASE = ../../../..
PROGS = test_fixed
SIMU_PROGS = test_fixed
test_fixed_SOURCES = test_fixed.c
MODULES = uart proto utils math/fixed math/random
CONFIGFILE = avrconfig.h
# atmega8, atmega8535, atmega128...
AVR_MCU = atmega128
# -O2 : speed
# -Os : size
OPTIMIZE = -O2

HOST_LIBS = -lm

include $(BASE)/make/Makefile.gen

# Automatic tests.

TEST_FILES = test.mul test.div test.cos test.sqrt
TEST_FILES := $(TEST_FILES:%=%.host) $(TEST_FILES:%=%.simu)
code_mul = m
code_div = d
code_cos = c
code_sqrt = s
code = $(code_$(1:test.%.$(2)=%))

clean.test:
	rm -f $(TEST_FILES)

SIMULAVR = simulavr -d $(AVR_MCU) -W 0x22,- -R 0x20,- -T uart0_exit

.PRECIOUS: $(TEST_FILES)

test.%.host: test_fixed.host
	echo '!$(call code,$@,host)' | ./$< > $@

test.%.simu: test_fixed.avr.simu.elf
	echo '!$(call code,$@,simu)\r' | $(SIMULAVR) -f $< > $@