]> git.sur5r.net Git - cc65/blob - test/val/Makefile
Hide stdout of tests returning an exit code.
[cc65] / test / val / Makefile
1 # Makefile for the regression tests that return an error code on failure
2
3 ifneq ($(shell echo),)
4   CMD_EXE = 1
5 endif
6
7 ifdef CMD_EXE
8   S = $(subst /,\,/)
9   NULLDEV = nul:
10   MKDIR = mkdir $(subst /,\,$1)
11   RMDIR = -rmdir /s /q $(subst /,\,$1)
12   DEL = del /f $(subst /,\,$1)
13 else
14   S = /
15   NULLDEV = /dev/null
16   MKDIR = mkdir -p $1
17   RMDIR = $(RM) -r $1
18   DEL = $(RM) $1
19 endif
20
21 SIM65FLAGS = -x 200000000
22
23 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
24 SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
25
26 WORKDIR = ../../testwrk/val
27
28 OPTIONS = g O Os Osi Osir Oi Oir Or
29
30 .PHONY: all clean
31
32 SOURCES := $(wildcard *.c)
33 TESTS := $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).6502.prg))
34 TESTS += $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).65c02.prg))
35
36 # FIXME: These tests fail when built with optimizations for the 65c02
37 TESTS := $(filter-out $(WORKDIR)/compare7.O%.65c02.prg,$(TESTS))
38 TESTS := $(filter-out $(WORKDIR)/compare8.O%.65c02.prg,$(TESTS))
39 TESTS := $(filter-out $(WORKDIR)/compare9.O%.65c02.prg,$(TESTS))
40 TESTS := $(filter-out $(WORKDIR)/compare10.O%.65c02.prg,$(TESTS))
41 TESTS := $(filter-out $(WORKDIR)/or1.O%.65c02.prg,$(TESTS))
42
43 all: $(TESTS)
44
45 $(WORKDIR):
46         $(call MKDIR,$(WORKDIR))
47
48 # Some files have "K & R"-style syntax.  Therefore, some forward
49 # function-declarations don't match the later function definitions.
50 # Those programs fail when fastcall is used; but, the cdecl calling convention
51 # tolerates those conflicts.  Therefore, make their functions default to cdecl.
52 #
53 $(WORKDIR)/cq4.%.prg  \
54 $(WORKDIR)/cq71.%.prg \
55 $(WORKDIR)/cq81.%.prg \
56 $(WORKDIR)/cq84.%.prg: CC65FLAGS += -Wc --all-cdecl
57
58 define PRG_template
59
60 $(WORKDIR)/%.$1.$2.prg: %.c | $(WORKDIR)
61         $(CL65) -t sim$2 $$(CC65FLAGS) -$1 -o $$@ $$<
62         $(SIM65) $(SIM65FLAGS) $$@ >$(NULLDEV)
63
64 endef # PRG_template
65
66 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),6502)))
67 $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
68
69 clean:
70         @$(call RMDIR,$(WORKDIR))
71         @$(call DEL,$(SOURCES:.c=.o))