1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 06:25:17 +00:00

Cleaned up test Makefiles.

This commit is contained in:
Oliver Schmidt
2017-03-19 17:48:12 +01:00
parent 3a30669ff6
commit 66634ef683
8 changed files with 253 additions and 226 deletions

View File

@@ -1,43 +1,30 @@
# top-level Makefile for the regression tests
# top-level makefile for the regression tests
# You can comment this special target when you debug the regression tests. # You can comment this special target when you debug the regression tests.
# Then, make will give you more progress reports. # Then, make will give you more progress reports.
.SILENT: .SILENT:
ifneq ($(shell echo),) ifneq ($(shell echo),)
CMD_EXE := 1 CMD_EXE = 1
endif endif
ifdef CMD_EXE ifdef CMD_EXE
EXE := .exe
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1) RMDIR = -rmdir /s /q $(subst /,\,$1)
else else
EXE :=
MKDIR = mkdir $1
RMDIR = $(RM) -r $1 RMDIR = $(RM) -r $1
endif endif
WORKDIR := ../testwrk WORKDIR = ../testwrk
CC := gcc
.PHONY: all dotests continue mostlyclean clean .PHONY: all dotests continue mostlyclean clean
all: dotests all: dotests
$(WORKDIR):
$(call MKDIR,$(WORKDIR))
$(WORKDIR)/bdiff$(EXE): bdiff.c | $(WORKDIR)
$(CC) -O2 -o $@ $<
.NOTPARALLEL: .NOTPARALLEL:
dotests: mostlyclean continue dotests: mostlyclean continue
continue: $(WORKDIR)/bdiff$(EXE) continue:
@$(MAKE) -C assembler all @$(MAKE) -C assembler all
@$(MAKE) -C disassembler all @$(MAKE) -C disassembler all
@$(MAKE) -C val all @$(MAKE) -C val all
@@ -46,6 +33,8 @@ continue: $(WORKDIR)/bdiff$(EXE)
@$(MAKE) -C misc all @$(MAKE) -C misc all
mostlyclean: mostlyclean:
@$(MAKE) -C assembler clean
@$(MAKE) -C disassembler clean
@$(MAKE) -C val clean @$(MAKE) -C val clean
@$(MAKE) -C ref clean @$(MAKE) -C ref clean
@$(MAKE) -C err clean @$(MAKE) -C err clean

View File

@@ -1,3 +0,0 @@
*.o
*.bin
*.lst

View File

@@ -1,45 +1,68 @@
# Makefile for the assembler regression tests
# makefile for the assembler regression tests ifneq ($(shell echo),)
CMD_EXE = 1
endif
BINDIR = ../../bin ifdef CMD_EXE
WORKDIR := ../../testwrk EXE = .exe
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
else
EXE =
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1
endif
BASE_TARGETS = 6502 6502x 65sc02 65c02 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
BASE_TARGETS += 4510 huc6280
OPCODE_TARGETS = $(BASE_TARGETS) WORKDIR = ../../testwrk/asm
CPUDETECT_TARGETS = $(BASE_TARGETS)
CPUDETECT_TARGETS += 65816 DIFF = $(WORKDIR)/bdiff$(EXE)
# default target defined later CC = gcc
all: CFLAGS = -O2
# generate opcode targets and expand target list .PHONY: all clean
define opcode
OPCODE_TARGETLIST += $$(WORKDIR)/$(1)-opcodes.bin
$$(WORKDIR)/$(1)-opcodes.bin: $(1)-opcodes.s
@$$(BINDIR)/cl65 --cpu $(1) -t none -l $$(WORKDIR)/$(1)-opcodes.lst --obj-path $$(WORKDIR) -o $$@ $$<
@diff -q $(1)-opcodes.ref $$@ || (cat $$(WORKDIR)/$(1)-opcodes.lst ; exit 1)
@echo ca65 --cpu $(1) opcodes ok
@rm -f $(1)-opcodes.o #workaround for #168
endef
$(foreach target,$(OPCODE_TARGETS),$(eval $(call opcode,$(target))))
# generate cpudetect targets and expand target list OPCODE_REFS := $(wildcard *-opcodes.ref)
define cpudetect OPCODE_CPUS = $(foreach ref,$(OPCODE_REFS),$(ref:%-opcodes.ref=%))
CPUDETECT_TARGETLIST += $$(WORKDIR)/$(1)-cpudetect.bin OPCODE_BINS = $(foreach cpu,$(OPCODE_CPUS),$(WORKDIR)/$(cpu)-opcodes.bin)
$$(WORKDIR)/$(1)-cpudetect.bin: cpudetect.s
@$$(BINDIR)/cl65 --cpu $(1) -t none -l $$(WORKDIR)/$(1)-cpudetect.lst --obj-path $$(WORKDIR) -o $$@ $$<
@diff -q $(1)-cpudetect.ref $$@ || (cat $$(WORKDIR)/$(1)-cpudetect.lst ; exit 1)
@echo ca65 --cpu $(1) cpudetect ok
@rm -f cpudetect.o #workaround for #168
endef
$(foreach target,$(CPUDETECT_TARGETS),$(eval $(call cpudetect,$(target))))
# now that all targets have been generated, get to the manual ones CPUDETECT_REFS := $(wildcard *-cpudetect.ref)
all: $(OPCODE_TARGETLIST) $(CPUDETECT_TARGETLIST) CPUDETECT_CPUS = $(foreach ref,$(CPUDETECT_REFS),$(ref:%-cpudetect.ref=%))
@# CPUDETECT_BINS = $(foreach cpu,$(CPUDETECT_CPUS),$(WORKDIR)/$(cpu)-cpudetect.bin)
.PHONY: all $(OPCODE_TARGETLIST) $(CPUDETECT_TARGETLIST) all: $(OPCODE_BINS) $(CPUDETECT_BINS)
$(WORKDIR):
$(call MKDIR,$(WORKDIR))
$(DIFF): ../bdiff.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $@ $<
define OPCODE_template
$(WORKDIR)/$1-opcodes.bin: $1-opcodes.s $(DIFF)
$(CL65) --cpu $1 -t none -l $(WORKDIR)/$1-opcodes.lst -o $$@ $$<
$(DIFF) $$@ $1-opcodes.ref
endef # OPCODE_template
$(foreach cpu,$(OPCODE_CPUS),$(eval $(call OPCODE_template,$(cpu))))
define CPUDETECT_template
$(WORKDIR)/$1-cpudetect.bin: cpudetect.s $(DIFF)
$(CL65) --cpu $1 -t none -l $(WORKDIR)/$1-cpudetect.lst -o $$@ $$<
$(DIFF) $$@ $1-cpudetect.ref
endef # CPUDETECT_template
$(foreach cpu,$(CPUDETECT_CPUS),$(eval $(call CPUDETECT_template,$(cpu))))
clean:
@$(call RMDIR,$(WORKDIR))
@$(call DEL,$(OPCODE_REFS:.ref=.o) cpudetect.o)

View File

@@ -1,42 +1,64 @@
# Makefile for the disassembler regression tests
# makefile for the disassembler regression tests ifneq ($(shell echo),)
CMD_EXE = 1
endif
BINDIR = ../../bin ifdef CMD_EXE
WORKDIR := ../../testwrk EXE = .exe
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
else
EXE =
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1
endif
#BASE_TARGETS = 6502 6502x 65sc02 65c02 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
#BASE_TARGETS += 4510 huc6280 DA65 := $(if $(wildcard ../../bin/da65*),../../bin/da65,da65)
BASE_TARGETS = 4510
WORKDIR = ../../testwrk/dasm
DIFF = $(WORKDIR)/bdiff$(EXE)
CC = gcc
CFLAGS = -O2
START = --start-addr 0x8000 START = --start-addr 0x8000
DISASS_TARGETS = $(BASE_TARGETS) .PHONY: all clean
SOURCES := $(wildcard *.s)
CPUS = $(foreach src,$(SOURCES),$(src:%-disass.s=%))
BINS = $(foreach cpu,$(CPUS),$(WORKDIR)/$(cpu)-reass.bin)
# default target defined later # default target defined later
all: all: $(BINS)
# generate opcode targets and expand target list $(WORKDIR):
define disass $(call MKDIR,$(WORKDIR))
DISASS_TARGETLIST += $$(WORKDIR)/$(1)-reass.bin $$(WORKDIR)/$(1)-reass.s $$(WORKDIR)/$(1)-disass.bin
$$(WORKDIR)/$(1)-disass.bin: $(1)-disass.s $(DIFF): ../bdiff.c | $(WORKDIR)
@$$(BINDIR)/cl65 --cpu $(1) -t none $(START) --obj-path $$(WORKDIR) -o $$@ $$< $(CC) $(CFLAGS) -o $@ $<
@rm -f $(1)-disass.o #workaround for #168
$$(WORKDIR)/$(1)-reass.s: $$(WORKDIR)/$(1)-disass.bin define DISASS_template
@$$(BINDIR)/da65 --cpu $(1) $(START) -o $$@ $$<
$$(WORKDIR)/$(1)-reass.bin: $$(WORKDIR)/$(1)-reass.s $(WORKDIR)/$1-disass.bin: $1-disass.s | $(WORKDIR)
@$$(BINDIR)/cl65 --cpu $(1) -t none $(START) --obj-path $$(WORKDIR) -o $$@ $$< $(CL65) --cpu $1 -t none $(START) -o $$@ $$<
@rm -f $(1)-reass.o #workaround for #168
@cmp $$@ $$(WORKDIR)/$(1)-disass.bin
@echo da65 --cpu $(1) ok
endef
$(foreach target,$(DISASS_TARGETS),$(eval $(call disass,$(target))))
# now that all targets have been generated, get to the manual ones $(WORKDIR)/$1-reass.s: $(WORKDIR)/$1-disass.bin
all: $(DISASS_TARGETLIST) $(DA65) --cpu $1 $(START) -o $$@ $$<
@#
.PHONY: all $(DISASS_TARGETLIST) $(WORKDIR)/$1-reass.bin: $(WORKDIR)/$1-reass.s $(DIFF)
$(CL65) --cpu $1 -t none $(START) -o $$@ $$<
$(DIFF) $$@ $(WORKDIR)/$1-disass.bin
endef # DISASS_template
$(foreach cpu,$(CPUS),$(eval $(call DISASS_template,$(cpu))))
clean:
@$(call RMDIR,$(WORKDIR))
@$(call DEL,$(SOURCES:.s=.o))

View File

@@ -1,24 +1,27 @@
# makefile for the tests that MUST NOT compile # Makefile for the tests that MUST NOT compile
ifneq ($(shell echo),) ifneq ($(shell echo),)
CMD_EXE := 1 CMD_EXE = 1
endif endif
ifdef CMD_EXE ifdef CMD_EXE
NOT := - # Hack NOT = - # Hack
DEL = -del /f $(subst /,\,$1) MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
else else
NOT := ! NOT = !
DEL = $(RM) $1 MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
endif endif
CC65 := $(if $(wildcard ../../bin/cc65*),../../bin/cc65,cc65) CC65 := $(if $(wildcard ../../bin/cc65*),../../bin/cc65,cc65)
WORKDIR := ../../testwrk WORKDIR = ../../testwrk/err
.PHONY: all clean .PHONY: all clean
TESTS := $(patsubst %.c,$(WORKDIR)/%.s,$(wildcard *.c)) SOURCES := $(wildcard *.c)
TESTS = $(patsubst %.c,$(WORKDIR)/%.s,$(SOURCES))
all: $(TESTS) all: $(TESTS)
@@ -26,4 +29,4 @@ $(WORKDIR)/%.s: %.c
$(NOT) $(CC65) -o $@ $< $(NOT) $(CC65) -o $@ $<
clean: clean:
@$(call DEL,$(TESTS)) @$(call RMDIR,$(WORKDIR))

View File

@@ -1,63 +1,85 @@
# Makefile for the remaining tests that need special care in one way or another
# makefile for the remaining tests that need special care in one way or another
ifneq ($(shell echo),) ifneq ($(shell echo),)
CMD_EXE := 1 CMD_EXE = 1
endif endif
ifdef CMD_EXE ifdef CMD_EXE
S := $(subst /,\,/) S = $(subst /,\,/)
NOT := - # Hack NOT = - # Hack
DEL = -del /f $(subst /,\,$1) EXE = .exe
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
else else
S := / S = /
NOT := ! NOT = !
EXE =
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1 DEL = $(RM) $1
endif endif
CC65FLAGS := -t sim6502 CC65FLAGS = -t sim6502
SIM65FLAGS := -x 200000000 SIM65FLAGS = -x 200000000
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65) SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
WORKDIR := ..$S..$Stestwrk WORKDIR = ..$S..$Stestwrk$Smisc
DIFF := $(WORKDIR)/bdiff
OPTIONS = g O Os Osi Osir Oi Oir Or
DIFF = $(WORKDIR)$Sbdiff$(EXE)
CC = gcc
CFLAGS = -O2
.PHONY: all clean .PHONY: all clean
SOURCES := $(wildcard *.c) SOURCES := $(wildcard *.c)
TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg)) TESTS = $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).prg))
all: $(TESTS) all: $(TESTS)
$(WORKDIR):
$(call MKDIR,$(WORKDIR))
$(DIFF): ../bdiff.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $@ $<
define PRG_template
# should compile, but then hangs in an endless loop # should compile, but then hangs in an endless loop
$(WORKDIR)/endless%prg: endless.c $(WORKDIR)/endless.$1.prg: endless.c | $(WORKDIR)
$(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@ $(CL65) $(CC65FLAGS) -$1 -o $$@ $$<
$(NOT) $(SIM65) $(SIM65FLAGS) $@ $(NOT) $(SIM65) $(SIM65FLAGS) $$@
# these need reference data that can't be generated by a host-compiled program, # these need reference data that can't be generated by a host-compiled program,
# in a useful way # in a useful way
$(WORKDIR)/limits%prg: limits.c $(WORKDIR)/limits.$1.prg: limits.c $(DIFF)
$(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@ $(CL65) $(CC65FLAGS) -$1 -o $$@ $$<
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/limits.out $(SIM65) $(SIM65FLAGS) $$@ > $(WORKDIR)/limits.$1.out
$(DIFF) $(WORKDIR)/limits.out limits.ref $(DIFF) $(WORKDIR)/limits.$1.out limits.ref
# the rest are tests that fail currently for one reason or another # the rest are tests that fail currently for one reason or another
$(WORKDIR)/fields%prg: fields.c $(WORKDIR)/fields.$1.prg: fields.c | $(WORKDIR)
@echo "FIXME: " $@ "currently will fail." @echo "FIXME: " $$@ "currently will fail."
$(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@ $(CL65) $(CC65FLAGS) -$1 -o $$@ $$<
-$(SIM65) $(SIM65FLAGS) $@ -$(SIM65) $(SIM65FLAGS) $$@
$(WORKDIR)/sitest%prg: sitest.c $(WORKDIR)/sitest.$1.prg: sitest.c | $(WORKDIR)
@echo "FIXME: " $@ "currently will fail." @echo "FIXME: " $$@ "currently will fail."
-$(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@ -$(CL65) $(CC65FLAGS) -$1 -o $$@ $$<
# -$(SIM65) $(SIM65FLAGS) $@ # -$(SIM65) $(SIM65FLAGS) $$@
$(WORKDIR)/cc65141011%prg: cc65141011.c $(WORKDIR)/cc65141011.$1.prg: cc65141011.c | $(WORKDIR)
@echo "FIXME: " $@ "currently can fail." @echo "FIXME: " $$@ "currently can fail."
$(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@ $(CL65) $(CC65FLAGS) -$1 -o $$@ $$<
-$(SIM65) $(SIM65FLAGS) $@ -$(SIM65) $(SIM65FLAGS) $$@
endef # PRG_template
$(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option))))
clean: clean:
@$(call DEL,$(TESTS)) @$(call RMDIR,$(WORKDIR))
@$(call DEL,$(SOURCES:.c=.o)) @$(call DEL,$(SOURCES:.c=.o))
@$(call DEL,$(SOURCES:%.c=$(WORKDIR)/%.out))

View File

@@ -1,102 +1,84 @@
# makefile for the regression tests that generate output which has to be # Makefile for the regression tests that generate output which has to be
# compared with reference output # compared with reference output
ifneq ($(shell echo),) ifneq ($(shell echo),)
CMD_EXE := 1 CMD_EXE = 1
endif endif
ifdef CMD_EXE ifdef CMD_EXE
S := $(subst /,\,/) S = $(subst /,\,/)
DEL = -del /f $(subst /,\,$1) EXE = .exe
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
else else
S := / S = /
EXE =
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1 DEL = $(RM) $1
endif endif
CC65FLAGS := -t sim6502 CC65FLAGS = -t sim6502
SIM65FLAGS := -x 200000000 SIM65FLAGS = -x 200000000
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65) SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
WORKDIR := ..$S..$Stestwrk WORKDIR = ..$S..$Stestwrk$Sref
DIFF := $(WORKDIR)/bdiff
CC := gcc OPTIONS = g O Os Osi Osir Oi Oir Or
CFLAGS := -O2 -Wall -W -Wextra -funsigned-char -fwrapv -fno-strict-overflow
DIFF = $(WORKDIR)$Sbdiff$(EXE)
CC = gcc
CFLAGS = -O2 -Wall -W -Wextra -funsigned-char -fwrapv -fno-strict-overflow
.PHONY: all clean .PHONY: all clean
SOURCES := $(wildcard *.c) SOURCES := $(wildcard *.c)
REFS := $(SOURCES:%.c=$(WORKDIR)/%.ref) REFS = $(SOURCES:%.c=$(WORKDIR)/%.ref)
TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg)) TESTS = $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).prg))
all: $(REFS) $(TESTS) all: $(REFS) $(TESTS)
# "yaccdbg.c" includes "yacc.c". $(WORKDIR):
# yaccdbg's built files must depend on both of them. $(call MKDIR,$(WORKDIR))
$(WORKDIR)/yaccdbg.ref: yacc.c $(WORKDIR)/%.ref: %.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $(WORKDIR)/$*.host $<
$(WORKDIR)/%.ref: %.c
$(CC) $(CFLAGS) $< -o $(WORKDIR)/$*.host
$(WORKDIR)$S$*.host > $@ $(WORKDIR)$S$*.host > $@
$(DIFF): ../bdiff.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $@ $<
# Some files have "K & R"-style syntax. Therefore, some forward # Some files have "K & R"-style syntax. Therefore, some forward
# function-declarations don't match the later function definitions. # function-declarations don't match the later function definitions.
# Those programs fail when fastcall is used; but, the cdecl calling convention # Those programs fail when fastcall is used; but, the cdecl calling convention
# tolerates those conflicts. Therefore, make their functions default to cdecl. # tolerates those conflicts. Therefore, make their functions default to cdecl.
# #
$(WORKDIR)/init%prg: CC65FLAGS += -Wc --all-cdecl $(WORKDIR)/init.%.prg \
$(WORKDIR)/switch.%rg: CC65FLAGS += -Wc --all-cdecl $(WORKDIR)/switch.%.prg \
$(WORKDIR)/yacc.%rg: CC65FLAGS += -Wc --all-cdecl $(WORKDIR)/yacc.%.prg \
$(WORKDIR)/yaccdbg%prg: CC65FLAGS += -Wc --all-cdecl $(WORKDIR)/yaccdbg.%.prg: CC65FLAGS += -Wc --all-cdecl
$(WORKDIR)/yaccdbg%prg: yacc.c # "yaccdbg.c" includes "yacc.c".
# yaccdbg's built files must depend on both of them.
#
$(WORKDIR)/yaccdbg.ref: yacc.c
$(WORKDIR)/yaccdbg.%.prg: yacc.c
$(WORKDIR)/%.prg: %.c $(WORKDIR)/%.ref define PRG_template
$(CL65) $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
$(WORKDIR)/%.o.prg: %.c $(WORKDIR)/%.ref $(WORKDIR)/%.$1.prg: %.c $(WORKDIR)/%.ref $(DIFF)
$(CL65) -O $(CC65FLAGS) $< -o $@ $(CL65) $$(CC65FLAGS) -$1 -o $$@ $$<
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out $(SIM65) $(SIM65FLAGS) $$@ > $(WORKDIR)/$$*.out
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref $(DIFF) $(WORKDIR)/$$*.out $(WORKDIR)/$$*.ref
$(WORKDIR)/%.os.prg: %.c $(WORKDIR)/%.ref endef # PRG_template
$(CL65) -Os $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
$(WORKDIR)/%.osi.prg: %.c $(WORKDIR)/%.ref $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option))))
$(CL65) -Osi $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
$(WORKDIR)/%.osir.prg: %.c $(WORKDIR)/%.ref
$(CL65) -Osir $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
$(WORKDIR)/%.oi.prg: %.c $(WORKDIR)/%.ref
$(CL65) -Oi $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
$(WORKDIR)/%.oir.prg: %.c $(WORKDIR)/%.ref
$(CL65) -Oir $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
$(WORKDIR)/%.or.prg: %.c $(WORKDIR)/%.ref
$(CL65) -Or $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
clean: clean:
@$(call DEL,$(TESTS)) @$(call RMDIR,$(WORKDIR))
@$(call DEL,$(SOURCES:.c=.o)) @$(call DEL,$(SOURCES:.c=.o))
@$(call DEL,$(SOURCES:%.c=$(WORKDIR)/%.out))
@$(call DEL,$(SOURCES:%.c=$(WORKDIR)/%.ref))
@$(call DEL,$(SOURCES:%.c=$(WORKDIR)/%.host))

View File

@@ -1,70 +1,59 @@
# Makefile for the regression tests that return an error code on failure
# makefile for the regression tests that return an error code on failure
ifneq ($(shell echo),) ifneq ($(shell echo),)
CMD_EXE := 1 CMD_EXE = 1
endif endif
ifdef CMD_EXE ifdef CMD_EXE
DEL = -del /f $(subst /,\,$1) MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
else else
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1 DEL = $(RM) $1
endif endif
CC65FLAGS := -t sim6502 CC65FLAGS = -t sim6502
SIM65FLAGS := -x 200000000 SIM65FLAGS = -x 200000000
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
WORKDIR := ../../testwrk WORKDIR = ../../testwrk/val
OPTIONS = g O Os Osi Osir Oi Oir Or
.PHONY: all clean .PHONY: all clean
SOURCES := $(wildcard *.c) SOURCES := $(wildcard *.c)
TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg)) TESTS = $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).prg))
all: $(TESTS) all: $(TESTS)
$(WORKDIR):
$(call MKDIR,$(WORKDIR))
# Some files have "K & R"-style syntax. Therefore, some forward # Some files have "K & R"-style syntax. Therefore, some forward
# function-declarations don't match the later function definitions. # function-declarations don't match the later function definitions.
# Those programs fail when fastcall is used; but, the cdecl calling convention # Those programs fail when fastcall is used; but, the cdecl calling convention
# tolerates those conflicts. Therefore, make their functions default to cdecl. # tolerates those conflicts. Therefore, make their functions default to cdecl.
# #
$(WORKDIR)/cq4%prg $(WORKDIR)/cq71.%rg $(WORKDIR)/cq81%prg $(WORKDIR)/cq84%prg: CC65FLAGS += -Wc --all-cdecl $(WORKDIR)/cq4.%.prg \
$(WORKDIR)/cq71.%.prg \
$(WORKDIR)/cq81.%.prg \
$(WORKDIR)/cq84.%.prg: CC65FLAGS += -Wc --all-cdecl
$(WORKDIR)/%.prg: %.c define PRG_template
$(CL65) $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@
$(WORKDIR)/%.o.prg: %.c $(WORKDIR)/%.$1.prg: %.c | $(WORKDIR)
$(CL65) -O $(CC65FLAGS) $< -o $@ $(CL65) $$(CC65FLAGS) -$1 -o $$@ $$<
$(SIM65) $(SIM65FLAGS) $@ $(SIM65) $(SIM65FLAGS) $$@
$(WORKDIR)/%.os.prg: %.c endef # PRG_template
$(CL65) -Os $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@
$(WORKDIR)/%.osi.prg: %.c $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option))))
$(CL65) -Osi $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@
$(WORKDIR)/%.osir.prg: %.c
$(CL65) -Osir $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@
$(WORKDIR)/%.oi.prg: %.c
$(CL65) -Oi $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@
$(WORKDIR)/%.oir.prg: %.c
$(CL65) -Oir $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@
$(WORKDIR)/%.or.prg: %.c
$(CL65) -Or $(CC65FLAGS) $< -o $@
$(SIM65) $(SIM65FLAGS) $@
clean: clean:
@$(call DEL,$(TESTS)) @$(call RMDIR,$(WORKDIR))
@$(call DEL,$(SOURCES:.c=.o)) @$(call DEL,$(SOURCES:.c=.o))