1 # Makefile for the regression tests that return an error code on failure
8 MKDIR = mkdir $(subst /,\,$1)
9 RMDIR = -rmdir /s /q $(subst /,\,$1)
10 DEL = del /f $(subst /,\,$1)
17 SIM65FLAGS = -x 200000000
19 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
20 SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
22 WORKDIR = ../../testwrk/val
24 OPTIONS = g O Os Osi Osir Oi Oir Or
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))
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))
42 $(call MKDIR,$(WORKDIR))
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.
49 $(WORKDIR)/cq4.%.prg \
50 $(WORKDIR)/cq71.%.prg \
51 $(WORKDIR)/cq81.%.prg \
52 $(WORKDIR)/cq84.%.prg: CC65FLAGS += -Wc --all-cdecl
56 $(WORKDIR)/%.$1.$2.prg: %.c | $(WORKDIR)
57 $(CL65) -t sim$2 $$(CC65FLAGS) -$1 -o $$@ $$<
58 $(SIM65) $(SIM65FLAGS) $$@
62 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),6502)))
63 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
66 @$(call RMDIR,$(WORKDIR))
67 @$(call DEL,$(SOURCES:.c=.o))