]> git.sur5r.net Git - cc65/blob - test/val/Makefile
b82d8fb51557798e3fcd6eeff4f8b32e4add44a3
[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   M := -
10   DEL = del /f $(subst /,\,$1)
11 else
12   M :=
13   DEL = $(RM) $1
14 endif
15
16 CC65FLAGS := -t sim6502
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
23
24 .PHONY: all clean
25
26 SOURCES := $(wildcard *.c)
27 TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg))
28
29 all: $(TESTS)
30
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.
35 #
36 $(WORKDIR)/cq4%prg $(WORKDIR)/cq71.%rg $(WORKDIR)/cq81%prg $(WORKDIR)/cq84%prg: CC65FLAGS += -Wc --all-cdecl
37
38 $(WORKDIR)/%.prg: %.c
39         $(CL65) $(CC65FLAGS) $< -o $@
40         $(SIM65) $(SIM65FLAGS) $@
41
42 $(WORKDIR)/%.o.prg: %.c
43         $(CL65) -O $(CC65FLAGS) $< -o $@
44         $(SIM65) $(SIM65FLAGS) $@
45
46 $(WORKDIR)/%.os.prg: %.c
47         $(CL65) -Os $(CC65FLAGS) $< -o $@
48         $(SIM65) $(SIM65FLAGS) $@
49
50 $(WORKDIR)/%.osi.prg: %.c
51         $(CL65) -Osi $(CC65FLAGS) $< -o $@
52         $(SIM65) $(SIM65FLAGS) $@
53
54 $(WORKDIR)/%.osir.prg: %.c
55         $(CL65) -Osir $(CC65FLAGS) $< -o $@
56         $(SIM65) $(SIM65FLAGS) $@
57
58 $(WORKDIR)/%.oi.prg: %.c
59         $(CL65) -Oi $(CC65FLAGS) $< -o $@
60         $(SIM65) $(SIM65FLAGS) $@
61
62 $(WORKDIR)/%.oir.prg: %.c
63         $(CL65) -Oir $(CC65FLAGS) $< -o $@
64         $(SIM65) $(SIM65FLAGS) $@
65
66 $(WORKDIR)/%.or.prg: %.c
67         $(CL65) -Or $(CC65FLAGS) $< -o $@
68         $(SIM65) $(SIM65FLAGS) $@
69
70 clean:
71         $M@$(call DEL,$(TESTS))
72         $M@$(call DEL,$(SOURCES:.c=.o))