]> git.sur5r.net Git - cc65/blob - test/misc/Makefile
Avoid "*** Recursive variable `RM' references itself (eventually)."
[cc65] / test / misc / Makefile
1
2 # makefile for the remaining tests that need special care in one way or another
3
4 ifneq ($(shell echo),)
5   CMD_EXE := 1
6 endif
7
8 ifdef CMD_EXE
9   S := $(subst /,\,/)
10   NOT := - # Hack
11   DEL = del /f $(subst /,\,$1)
12 else
13   S := /
14   NOT := !
15   DEL = $(RM) $1
16 endif
17
18 CC65FLAGS := -t sim6502
19 SIM65FLAGS := -x 200000000
20
21 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
22 SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
23
24 WORKDIR := ..$S..$Stestwrk
25 DIFF := $(WORKDIR)/bdiff
26
27 .PHONY: all clean
28
29 SOURCES := $(wildcard *.c)
30 TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg))
31
32 all: $(TESTS)
33
34 # should compile, but then hangs in an endless loop
35 $(WORKDIR)/endless%prg: endless.c
36         $(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@
37         $(NOT) $(SIM65) $(SIM65FLAGS) $@
38
39 # these need reference data that can't be generated by a host-compiled program,
40 # in a useful way
41 $(WORKDIR)/limits%prg: limits.c
42         $(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@
43         $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/limits.out
44         $(DIFF) $(WORKDIR)/limits.out limits.ref
45
46 # the rest are tests that fail currently for one reason or another
47 $(WORKDIR)/fields%prg: fields.c
48         @echo "FIXME: " $@ "currently will fail."
49         $(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@
50         -$(SIM65) $(SIM65FLAGS) $@
51 $(WORKDIR)/sitest%prg: sitest.c
52         @echo "FIXME: " $@ "currently will fail."
53         -$(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@
54 #       -$(SIM65) $(SIM65FLAGS) $@
55
56 clean:
57         -@$(call DEL,$(TESTS))
58         -@$(call DEL,$(SOURCES:.c=.o))
59         -@$(call DEL,$(SOURCES:%.c=$(WORKDIR)/%.out))