]> git.sur5r.net Git - cc65/blob - test/ref/Makefile
generate reference output using host compiler, compare using diff, fix yacc input...
[cc65] / test / ref / Makefile
1
2 # makefile for the regression tests that generate output which has to be
3 # compared with reference output
4
5 CC65FLAGS = -t sim6502
6 SIM65FLAGS = -x 200000000
7
8 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
9 SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
10
11 RM := rm -f
12 DIFF := diff -q
13
14 CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow
15
16 .PHONY: all
17
18 REFS := $(patsubst %.c,%.ref,$(wildcard *.c))
19
20 TESTS := $(patsubst %.c,%.prg,$(wildcard *.c))
21 TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c))
22 TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c))
23 TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c))
24 TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c))
25 TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c))
26 TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c))
27 TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c))
28
29 all: $(REFS) $(TESTS)
30
31 %.ref: %.c
32         $(CC) $(CFLAGS) $< -o $*.host
33         ./$*.host > $@
34
35 %.prg: %.c %.ref
36         $(CL65) $(CC65FLAGS) $< -o $@
37         $(SIM65) $(SIM65FLAGS) $@ > $*.out
38         $(DIFF) $*.out $*.ref
39
40 %.o.prg: %.c %.ref
41         $(CL65) $(CC65FLAGS) $< -o $@
42         $(SIM65) $(SIM65FLAGS) $@ > $*.out
43         $(DIFF) $*.out $*.ref
44
45 %.os.prg: %.c %.ref
46         $(CL65) $(CC65FLAGS) $< -o $@
47         $(SIM65) $(SIM65FLAGS) $@ > $*.out
48         $(DIFF) $*.out $*.ref
49
50 %.osi.prg: %.c %.ref
51         $(CL65) $(CC65FLAGS) $< -o $@
52         $(SIM65) $(SIM65FLAGS) $@ > $*.out
53         $(DIFF) $*.out $*.ref
54
55 %.osir.prg: %.c %.ref
56         $(CL65) $(CC65FLAGS) $< -o $@
57         $(SIM65) $(SIM65FLAGS) $@ > $*.out
58         $(DIFF) $*.out $*.ref
59
60 %.oi.prg: %.c %.ref
61         $(CL65) $(CC65FLAGS) $< -o $@
62         $(SIM65) $(SIM65FLAGS) $@ > $*.out
63         $(DIFF) $*.out $*.ref
64
65 %.oir.prg: %.c %.ref
66         $(CL65) $(CC65FLAGS) $< -o $@
67         $(SIM65) $(SIM65FLAGS) $@ > $*.out
68         $(DIFF) $*.out $*.ref
69
70 %.or.prg: %.c %.ref
71         $(CL65) $(CC65FLAGS) $< -o $@
72         $(SIM65) $(SIM65FLAGS) $@ > $*.out
73         $(DIFF) $*.out $*.ref
74
75 clean:
76         @$(RM) *.o
77         @$(RM) *.prg
78         @$(RM) *.out
79         @$(RM) *.ref
80         @$(RM) *.host