]> git.sur5r.net Git - cc65/blob - test/misc/Makefile
Missed the comment.
[cc65] / test / misc / Makefile
1 # Makefile for the remaining tests that need special care in one way or another
2
3 ifneq ($(shell echo),)
4   CMD_EXE = 1
5 endif
6
7 ifdef CMD_EXE
8   S = $(subst /,\,/)
9   NOT = - # Hack
10   EXE = .exe
11   NULLDEV = nul:
12   MKDIR = mkdir $(subst /,\,$1)
13   RMDIR = -rmdir /s /q $(subst /,\,$1)
14   DEL = del /f $(subst /,\,$1)
15 else
16   S = /
17   NOT = !
18   EXE =
19   NULLDEV = /dev/null
20   MKDIR = mkdir -p $1
21   RMDIR = $(RM) -r $1
22   DEL = $(RM) $1
23 endif
24
25 ifdef QUIET
26   .SILENT:
27   NULLOUT = >$(NULLDEV)
28   NULLERR = 2>$(NULLDEV)
29 endif
30
31 SIM65FLAGS = -x 200000000
32
33 CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65)
34 SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
35
36 WORKDIR = ..$S..$Stestwrk$Smisc
37
38 OPTIONS = g O Os Osi Osir Osr Oi Oir Or
39
40 DIFF = $(WORKDIR)$Sbdiff$(EXE)
41
42 CC = gcc
43 CFLAGS = -O2
44
45 .PHONY: all clean
46
47 SOURCES := $(wildcard *.c)
48 TESTS  = $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).6502.prg))
49 TESTS += $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).65c02.prg))
50
51 all: $(TESTS)
52
53 $(WORKDIR):
54         $(call MKDIR,$(WORKDIR))
55
56 $(DIFF): ../bdiff.c | $(WORKDIR)
57         $(CC) $(CFLAGS) -o $@ $<
58
59 define PRG_template
60
61 # should compile, but then hangs in an endless loop
62 $(WORKDIR)/endless.$1.$2.prg: endless.c | $(WORKDIR)
63         $(if $(QUIET),echo misc/endless.$1.$2.prg)
64         $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
65         $(NOT) $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT) $(NULLERR)
66
67 # these need reference data that can't be generated by a host-compiled program,
68 # in a useful way
69 $(WORKDIR)/limits.$1.$2.prg: limits.c $(DIFF)
70         $(if $(QUIET),echo misc/limits.$1.$2.prg)
71         $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
72         $(SIM65) $(SIM65FLAGS) $$@ > $(WORKDIR)/limits.$1.out
73         $(DIFF) $(WORKDIR)/limits.$1.out limits.ref
74
75 # here we check if the right warnings are produced
76 $(WORKDIR)/goto.$1.$2.prg: goto.c $(DIFF)
77         $(if $(QUIET),echo misc/goto.$1.$2.prg)
78         $(CL65) -t sim$2 -$1 -o $$@ $$< 2>$(WORKDIR)/goto.$1.out
79         $(DIFF) $(WORKDIR)/goto.$1.out goto.ref
80
81 # the rest are tests that fail currently for one reason or another
82 $(WORKDIR)/fields.$1.$2.prg: fields.c | $(WORKDIR)
83         @echo "FIXME: " $$@ "currently will fail."
84         $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
85         -$(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT)
86 $(WORKDIR)/sitest.$1.$2.prg: sitest.c | $(WORKDIR)
87         @echo "FIXME: " $$@ "currently will fail."
88         -$(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
89 #       -$(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT)
90 $(WORKDIR)/cc65141011.$1.$2.prg: cc65141011.c | $(WORKDIR)
91         @echo "FIXME: " $$@ "currently can fail."
92         $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
93         -$(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT)
94
95 endef # PRG_template
96
97 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),6502)))
98 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
99
100 clean:
101         @$(call RMDIR,$(WORKDIR))
102         @$(call DEL,$(SOURCES:.c=.o))