]> git.sur5r.net Git - cc65/blob - test/ref/Makefile
b3b555aefa117461d6fad87e160de53fb478eddc
[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 ifneq ($(shell echo),)
6   CMD_EXE = 1
7 endif
8
9 CC65FLAGS = -t sim6502
10 SIM65FLAGS = -x 200000000
11
12 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
13 SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
14
15 ifdef CMD_EXE
16 RM := del /f
17 DIFF := fc
18 else
19 RM := rm -f
20 DIFF := diff -q
21 endif
22
23 CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow
24
25 .PHONY: all clean
26
27 REFS := $(patsubst %.c,%.ref,$(wildcard *.c))
28
29 TESTS := $(patsubst %.c,%.prg,$(wildcard *.c))
30 TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c))
31 TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c))
32 TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c))
33 TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c))
34 TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c))
35 TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c))
36 TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c))
37
38 all: $(REFS) $(TESTS)
39
40 %.ref: %.c
41         $(CC) $(CFLAGS) $< -o $*.host
42         ./$*.host > $@
43
44 %.prg: %.c %.ref
45         $(CL65) $(CC65FLAGS) $< -o $@
46         $(SIM65) $(SIM65FLAGS) $@ > $*.out
47         $(DIFF) $*.out $*.ref
48
49 %.o.prg: %.c %.ref
50         $(CL65) $(CC65FLAGS) $< -o $@
51         $(SIM65) $(SIM65FLAGS) $@ > $*.out
52         $(DIFF) $*.out $*.ref
53
54 %.os.prg: %.c %.ref
55         $(CL65) $(CC65FLAGS) $< -o $@
56         $(SIM65) $(SIM65FLAGS) $@ > $*.out
57         $(DIFF) $*.out $*.ref
58
59 %.osi.prg: %.c %.ref
60         $(CL65) $(CC65FLAGS) $< -o $@
61         $(SIM65) $(SIM65FLAGS) $@ > $*.out
62         $(DIFF) $*.out $*.ref
63
64 %.osir.prg: %.c %.ref
65         $(CL65) $(CC65FLAGS) $< -o $@
66         $(SIM65) $(SIM65FLAGS) $@ > $*.out
67         $(DIFF) $*.out $*.ref
68
69 %.oi.prg: %.c %.ref
70         $(CL65) $(CC65FLAGS) $< -o $@
71         $(SIM65) $(SIM65FLAGS) $@ > $*.out
72         $(DIFF) $*.out $*.ref
73
74 %.oir.prg: %.c %.ref
75         $(CL65) $(CC65FLAGS) $< -o $@
76         $(SIM65) $(SIM65FLAGS) $@ > $*.out
77         $(DIFF) $*.out $*.ref
78
79 %.or.prg: %.c %.ref
80         $(CL65) $(CC65FLAGS) $< -o $@
81         $(SIM65) $(SIM65FLAGS) $@ > $*.out
82         $(DIFF) $*.out $*.ref
83
84 clean:
85         @$(RM) *.o
86         @$(RM) *.prg
87         @$(RM) *.out
88         @$(RM) *.ref
89         @$(RM) *.host