]> git.sur5r.net Git - cc65/blob - test/misc/Makefile
Hide stdout of tests returning an exit code.
[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   MKDIR = mkdir $(subst /,\,$1)
12   RMDIR = -rmdir /s /q $(subst /,\,$1)
13   DEL = del /f $(subst /,\,$1)
14 else
15   S = /
16   NOT = !
17   EXE =
18   MKDIR = mkdir -p $1
19   RMDIR = $(RM) -r $1
20   DEL = $(RM) $1
21 endif
22
23 SIM65FLAGS = -x 200000000
24
25 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
26 SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
27
28 WORKDIR = ..$S..$Stestwrk$Smisc
29
30 OPTIONS = g O Os Osi Osir Oi Oir Or
31
32 DIFF = $(WORKDIR)$Sbdiff$(EXE)
33
34 CC = gcc
35 CFLAGS = -O2
36
37 .PHONY: all clean
38
39 SOURCES := $(wildcard *.c)
40 TESTS  = $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).6502.prg))
41 TESTS += $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).65c02.prg))
42
43 all: $(TESTS)
44
45 $(WORKDIR):
46         $(call MKDIR,$(WORKDIR))
47
48 $(DIFF): ../bdiff.c | $(WORKDIR)
49         $(CC) $(CFLAGS) -o $@ $<
50
51 define PRG_template
52
53 # should compile, but then hangs in an endless loop
54 $(WORKDIR)/endless.$1.$2.prg: endless.c | $(WORKDIR)
55         $(CL65) -t sim$2 -$1 -o $$@ $$<
56         $(NOT) $(SIM65) $(SIM65FLAGS) $$@
57
58 # these need reference data that can't be generated by a host-compiled program,
59 # in a useful way
60 $(WORKDIR)/limits.$1.$2.prg: limits.c $(DIFF)
61         $(CL65) -t sim$2 -$1 -o $$@ $$<
62         $(SIM65) $(SIM65FLAGS) $$@ > $(WORKDIR)/limits.$1.out
63         $(DIFF) $(WORKDIR)/limits.$1.out limits.ref
64
65 # the rest are tests that fail currently for one reason or another
66 $(WORKDIR)/fields.$1.$2.prg: fields.c | $(WORKDIR)
67         @echo "FIXME: " $$@ "currently will fail."
68         $(CL65) -t sim$2 -$1 -o $$@ $$<
69         -$(SIM65) $(SIM65FLAGS) $$@
70 $(WORKDIR)/sitest.$1.$2.prg: sitest.c | $(WORKDIR)
71         @echo "FIXME: " $$@ "currently will fail."
72         -$(CL65) -t sim$2 -$1 -o $$@ $$<
73 #       -$(SIM65) $(SIM65FLAGS) $$@
74 $(WORKDIR)/cc65141011.$1.$2.prg: cc65141011.c | $(WORKDIR)
75         @echo "FIXME: " $$@ "currently can fail."
76         $(CL65) -t sim$2 -$1 -o $$@ $$<
77         -$(SIM65) $(SIM65FLAGS) $$@
78
79 endef # PRG_template
80
81 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),6502)))
82 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
83
84 clean:
85         @$(call RMDIR,$(WORKDIR))
86         @$(call DEL,$(SOURCES:.c=.o))