2 # makefile for the regression tests that return an error code on failure
10 DEL = del /f $(subst /,\,$1)
16 CC65FLAGS := -t sim6502
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
26 SOURCES := $(wildcard *.c)
27 TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg))
31 # Some files have "K & R"-style syntax. Therefore, some forward
32 # function-declarations don't match the later function definitions.
33 # Those programs fail when fastcall is used; but, the cdecl calling convention
34 # tolerates those conflicts. Therefore, make their functions default to cdecl.
36 $(WORKDIR)/cq4%prg $(WORKDIR)/cq71.%rg $(WORKDIR)/cq81%prg $(WORKDIR)/cq84%prg: CC65FLAGS += -Wc --all-cdecl
39 $(CL65) $(CC65FLAGS) $< -o $@
40 $(SIM65) $(SIM65FLAGS) $@
42 $(WORKDIR)/%.o.prg: %.c
43 $(CL65) -O $(CC65FLAGS) $< -o $@
44 $(SIM65) $(SIM65FLAGS) $@
46 $(WORKDIR)/%.os.prg: %.c
47 $(CL65) -Os $(CC65FLAGS) $< -o $@
48 $(SIM65) $(SIM65FLAGS) $@
50 $(WORKDIR)/%.osi.prg: %.c
51 $(CL65) -Osi $(CC65FLAGS) $< -o $@
52 $(SIM65) $(SIM65FLAGS) $@
54 $(WORKDIR)/%.osir.prg: %.c
55 $(CL65) -Osir $(CC65FLAGS) $< -o $@
56 $(SIM65) $(SIM65FLAGS) $@
58 $(WORKDIR)/%.oi.prg: %.c
59 $(CL65) -Oi $(CC65FLAGS) $< -o $@
60 $(SIM65) $(SIM65FLAGS) $@
62 $(WORKDIR)/%.oir.prg: %.c
63 $(CL65) -Oir $(CC65FLAGS) $< -o $@
64 $(SIM65) $(SIM65FLAGS) $@
66 $(WORKDIR)/%.or.prg: %.c
67 $(CL65) -Or $(CC65FLAGS) $< -o $@
68 $(SIM65) $(SIM65FLAGS) $@
71 $M@$(call DEL,$(TESTS))
72 $M@$(call DEL,$(SOURCES:.c=.o))