]> git.sur5r.net Git - cc65/blob - test/ref/Makefile
use 'testwrk' dir for bdiff
[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 else
18 RM := rm -f
19 endif
20
21 WORKDIR := ./../../testwrk
22
23 DIFF := $(WORKDIR)/bdiff
24
25 CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow
26
27 .PHONY: all clean
28
29 REFS := $(patsubst %.c,%.ref,$(wildcard *.c))
30
31 TESTS := $(patsubst %.c,%.prg,$(wildcard *.c))
32 TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c))
33 TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c))
34 TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c))
35 TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c))
36 TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c))
37 TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c))
38 TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c))
39
40 all: $(REFS) $(TESTS)
41
42 %.ref: %.c
43         $(CC) $(CFLAGS) $< -o $*.host
44         ./$*.host > $@
45
46 %.prg: %.c %.ref
47         $(CL65) $(CC65FLAGS) $< -o $@
48         $(SIM65) $(SIM65FLAGS) $@ > $*.out
49         $(DIFF) $*.out $*.ref
50
51 %.o.prg: %.c %.ref
52         $(CL65) $(CC65FLAGS) $< -o $@
53         $(SIM65) $(SIM65FLAGS) $@ > $*.out
54         $(DIFF) $*.out $*.ref
55
56 %.os.prg: %.c %.ref
57         $(CL65) $(CC65FLAGS) $< -o $@
58         $(SIM65) $(SIM65FLAGS) $@ > $*.out
59         $(DIFF) $*.out $*.ref
60
61 %.osi.prg: %.c %.ref
62         $(CL65) $(CC65FLAGS) $< -o $@
63         $(SIM65) $(SIM65FLAGS) $@ > $*.out
64         $(DIFF) $*.out $*.ref
65
66 %.osir.prg: %.c %.ref
67         $(CL65) $(CC65FLAGS) $< -o $@
68         $(SIM65) $(SIM65FLAGS) $@ > $*.out
69         $(DIFF) $*.out $*.ref
70
71 %.oi.prg: %.c %.ref
72         $(CL65) $(CC65FLAGS) $< -o $@
73         $(SIM65) $(SIM65FLAGS) $@ > $*.out
74         $(DIFF) $*.out $*.ref
75
76 %.oir.prg: %.c %.ref
77         $(CL65) $(CC65FLAGS) $< -o $@
78         $(SIM65) $(SIM65FLAGS) $@ > $*.out
79         $(DIFF) $*.out $*.ref
80
81 %.or.prg: %.c %.ref
82         $(CL65) $(CC65FLAGS) $< -o $@
83         $(SIM65) $(SIM65FLAGS) $@ > $*.out
84         $(DIFF) $*.out $*.ref
85
86 clean:
87         @$(RM) *.o
88         @$(RM) *.prg
89         @$(RM) *.out
90         @$(RM) *.ref
91         @$(RM) *.host