1 # Makefile for the regression tests that return an error code on failure
10 MKDIR = mkdir $(subst /,\,$1)
11 RMDIR = -rmdir /s /q $(subst /,\,$1)
12 DEL = del /f $(subst /,\,$1)
24 NULLERR = 2>$(NULLDEV)
27 SIM65FLAGS = -x 200000000
29 CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65)
30 SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
32 WORKDIR = ../../testwrk/val
34 OPTIONS = g O Os Osi Osir Oi Oir Or
38 SOURCES := $(wildcard *.c)
39 TESTS := $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).6502.prg))
40 TESTS += $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).65c02.prg))
42 # FIXME: These tests fail when built with optimizations for the 65c02
43 TESTS := $(filter-out $(WORKDIR)/compare7.O%.65c02.prg,$(TESTS))
44 TESTS := $(filter-out $(WORKDIR)/compare8.O%.65c02.prg,$(TESTS))
45 TESTS := $(filter-out $(WORKDIR)/compare9.O%.65c02.prg,$(TESTS))
46 TESTS := $(filter-out $(WORKDIR)/compare10.O%.65c02.prg,$(TESTS))
47 TESTS := $(filter-out $(WORKDIR)/or1.O%.65c02.prg,$(TESTS))
52 $(call MKDIR,$(WORKDIR))
54 # Some files have "K & R"-style syntax. Therefore, some forward
55 # function-declarations don't match the later function definitions.
56 # Those programs fail when fastcall is used; but, the cdecl calling convention
57 # tolerates those conflicts. Therefore, make their functions default to cdecl.
59 $(WORKDIR)/cq4.%.prg \
60 $(WORKDIR)/cq71.%.prg \
61 $(WORKDIR)/cq81.%.prg \
62 $(WORKDIR)/cq84.%.prg: CC65FLAGS += -Wc --all-cdecl
66 $(WORKDIR)/%.$1.$2.prg: %.c | $(WORKDIR)
67 $(if $(QUIET),echo val/$$*.$1.$2.prg)
68 $(CL65) -t sim$2 $$(CC65FLAGS) -$1 -o $$@ $$< $(NULLERR)
69 $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT)
73 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),6502)))
74 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
77 @$(call RMDIR,$(WORKDIR))
78 @$(call DEL,$(SOURCES:.c=.o))