]> git.sur5r.net Git - cc65/blob - test/val/Makefile
Made test Makefiles work with CMD.EXE
[cc65] / test / val / Makefile
1
2 # makefile for the regression tests that return an error code on failure
3
4 ifneq ($(shell echo),)
5   CMD_EXE := 1
6 endif
7
8 ifdef CMD_EXE
9   RM = del /f $(subst /,\,$1)
10 else
11   RM = $(RM) $1
12 endif
13
14 CC65FLAGS := -t sim6502
15 SIM65FLAGS := -x 200000000
16
17 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
18 SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
19
20 WORKDIR := ../../testwrk
21
22 .PHONY: all clean
23
24 SOURCES := $(wildcard *.c)
25 TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg))
26
27 all: $(TESTS)
28
29 # Some files have "K & R"-style syntax.  Therefore, some forward
30 # function-declarations don't match the later function definitions.
31 # Those programs fail when fastcall is used; but, the cdecl calling convention
32 # tolerates those conflicts.  Therefore, make their functions default to cdecl.
33 #
34 $(WORKDIR)/cq4%prg $(WORKDIR)/cq71.%rg $(WORKDIR)/cq81%prg $(WORKDIR)/cq84%prg: CC65FLAGS += -Wc --all-cdecl
35
36 $(WORKDIR)/%.prg: %.c
37         $(CL65) $(CC65FLAGS) $< -o $@
38         $(SIM65) $(SIM65FLAGS) $@
39
40 $(WORKDIR)/%.o.prg: %.c
41         $(CL65) -O $(CC65FLAGS) $< -o $@
42         $(SIM65) $(SIM65FLAGS) $@
43
44 $(WORKDIR)/%.os.prg: %.c
45         $(CL65) -Os $(CC65FLAGS) $< -o $@
46         $(SIM65) $(SIM65FLAGS) $@
47
48 $(WORKDIR)/%.osi.prg: %.c
49         $(CL65) -Osi $(CC65FLAGS) $< -o $@
50         $(SIM65) $(SIM65FLAGS) $@
51
52 $(WORKDIR)/%.osir.prg: %.c
53         $(CL65) -Osir $(CC65FLAGS) $< -o $@
54         $(SIM65) $(SIM65FLAGS) $@
55
56 $(WORKDIR)/%.oi.prg: %.c
57         $(CL65) -Oi $(CC65FLAGS) $< -o $@
58         $(SIM65) $(SIM65FLAGS) $@
59
60 $(WORKDIR)/%.oir.prg: %.c
61         $(CL65) -Oir $(CC65FLAGS) $< -o $@
62         $(SIM65) $(SIM65FLAGS) $@
63
64 $(WORKDIR)/%.or.prg: %.c
65         $(CL65) -Or $(CC65FLAGS) $< -o $@
66         $(SIM65) $(SIM65FLAGS) $@
67
68 clean:
69         -@$(call RM,$(TESTS))
70         -@$(call RM,$(SOURCES:.c=.o))