]> git.sur5r.net Git - cc65/blob - test/val/Makefile
Run test for the 65C02 code generator / runtime too.
[cc65] / test / val / Makefile
1 # Makefile for the regression tests that return an error code on failure
2
3 ifneq ($(shell echo),)
4   CMD_EXE = 1
5 endif
6
7 ifdef CMD_EXE
8   MKDIR = mkdir $(subst /,\,$1)
9   RMDIR = -rmdir /s /q $(subst /,\,$1)
10   DEL = del /f $(subst /,\,$1)
11 else
12   MKDIR = mkdir -p $1
13   RMDIR = $(RM) -r $1
14   DEL = $(RM) $1
15 endif
16
17 SIM65FLAGS = -x 200000000
18
19 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
20 SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
21
22 WORKDIR = ../../testwrk/val
23
24 OPTIONS = g O Os Osi Osir Oi Oir Or
25
26 .PHONY: all clean
27
28 SOURCES := $(wildcard *.c)
29 TESTS := $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).6502.prg))
30 TESTS += $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).65c02.prg))
31
32 # FIXME: These tests fail when built with optimizations for the 65c02
33 TESTS := $(filter-out $(WORKDIR)/compare7.O%.65c02.prg,$(TESTS))
34 TESTS := $(filter-out $(WORKDIR)/compare8.O%.65c02.prg,$(TESTS))
35 TESTS := $(filter-out $(WORKDIR)/compare9.O%.65c02.prg,$(TESTS))
36 TESTS := $(filter-out $(WORKDIR)/compare10.O%.65c02.prg,$(TESTS))
37 TESTS := $(filter-out $(WORKDIR)/or1.O%.65c02.prg,$(TESTS))
38
39 all: $(TESTS)
40
41 $(WORKDIR):
42         $(call MKDIR,$(WORKDIR))
43
44 # Some files have "K & R"-style syntax.  Therefore, some forward
45 # function-declarations don't match the later function definitions.
46 # Those programs fail when fastcall is used; but, the cdecl calling convention
47 # tolerates those conflicts.  Therefore, make their functions default to cdecl.
48 #
49 $(WORKDIR)/cq4.%.prg  \
50 $(WORKDIR)/cq71.%.prg \
51 $(WORKDIR)/cq81.%.prg \
52 $(WORKDIR)/cq84.%.prg: CC65FLAGS += -Wc --all-cdecl
53
54 define PRG_template
55
56 $(WORKDIR)/%.$1.$2.prg: %.c | $(WORKDIR)
57         $(CL65) -t sim$2 $$(CC65FLAGS) -$1 -o $$@ $$<
58         $(SIM65) $(SIM65FLAGS) $$@
59
60 endef # PRG_template
61
62 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),6502)))
63 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
64
65 clean:
66         @$(call RMDIR,$(WORKDIR))
67         @$(call DEL,$(SOURCES:.c=.o))