1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

Avoid cl65 in tests.

cl65 creates intermediate files based on the source file name in the source file directory. Calling cl65 in parallel with the same source file causes those intermediate files to get overwritten.

Fixes #1080
This commit is contained in:
Oliver Schmidt 2020-08-26 20:37:28 +02:00
parent 4c912a0fbe
commit c658acbf85
6 changed files with 61 additions and 71 deletions

View File

@ -8,23 +8,22 @@ ifdef CMD_EXE
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
ifdef QUIET
.SILENT:
endif
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
CA65 := $(if $(wildcard ../../bin/ca65*),../../bin/ca65,ca65)
LD65 := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
WORKDIR = ../../testwrk/asm
DIFF = $(WORKDIR)/isequal$(EXE)
ISEQUAL = $(WORKDIR)/isequal$(EXE)
CC = gcc
CFLAGS = -O2
@ -44,29 +43,28 @@ all: $(OPCODE_BINS) $(CPUDETECT_BINS)
$(WORKDIR):
$(call MKDIR,$(WORKDIR))
$(DIFF): ../isequal.c | $(WORKDIR)
$(ISEQUAL): ../isequal.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $@ $<
define OPCODE_template
$(WORKDIR)/$1-opcodes.bin: $1-opcodes.s $(DIFF)
$(WORKDIR)/$1-opcodes.bin: $1-opcodes.s $(ISEQUAL)
$(if $(QUIET),echo asm/$1-opcodes.bin)
$(CL65) --cpu $1 -t none -l $(WORKDIR)/$1-opcodes.lst -o $$@ $$<
$(DIFF) $$@ $1-opcodes.ref
$(CA65) --cpu $1 -t none -l $(WORKDIR)/$1-opcodes.lst -o $(WORKDIR)/$1-opcodes.o $$<
$(LD65) -t none -o $$@ $(WORKDIR)/$1-opcodes.o none.lib
$(ISEQUAL) $$@ $1-opcodes.ref
endef # OPCODE_template
$(foreach cpu,$(OPCODE_CPUS),$(eval $(call OPCODE_template,$(cpu))))
# cpudetect.o is written by multiple rules
.NOTPARALLEL:
define CPUDETECT_template
$(WORKDIR)/$1-cpudetect.bin: cpudetect.s $(DIFF)
$(WORKDIR)/$1-cpudetect.bin: cpudetect.s $(ISEQUAL)
$(if $(QUIET),echo asm/$1-cpudetect.bin)
$(CL65) --cpu $1 -t none -l $(WORKDIR)/$1-cpudetect.lst -o $$@ $$<
$(DIFF) $$@ $1-cpudetect.ref
$(CA65) --cpu $1 -t none -l $(WORKDIR)/$1-cpudetect.lst -o $(WORKDIR)/$1-cpudetect.o $$<
$(LD65) -t none -o $$@ $(WORKDIR)/$1-cpudetect.o none.lib
$(ISEQUAL) $$@ $1-cpudetect.ref
endef # CPUDETECT_template
@ -74,4 +72,3 @@ $(foreach cpu,$(CPUDETECT_CPUS),$(eval $(call CPUDETECT_template,$(cpu))))
clean:
@$(call RMDIR,$(WORKDIR))
@$(call DEL,$(OPCODE_REFS:.ref=.o) cpudetect.o)

View File

@ -8,12 +8,10 @@ ifdef CMD_EXE
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
ifdef QUIET
@ -25,7 +23,7 @@ DA65 := $(if $(wildcard ../../bin/da65*),../../bin/da65,da65)
WORKDIR = ../../testwrk/dasm
DIFF = $(WORKDIR)/isequal$(EXE)
ISEQUAL = $(WORKDIR)/isequal$(EXE)
CC = gcc
CFLAGS = -O2
@ -44,7 +42,7 @@ all: $(BINS)
$(WORKDIR):
$(call MKDIR,$(WORKDIR))
$(DIFF): ../isequal.c | $(WORKDIR)
$(ISEQUAL): ../isequal.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $@ $<
define DISASS_template
@ -55,10 +53,10 @@ $(WORKDIR)/$1-disass.bin: $1-disass.s | $(WORKDIR)
$(WORKDIR)/$1-reass.s: $(WORKDIR)/$1-disass.bin
$(DA65) --cpu $1 $(START) -o $$@ $$<
$(WORKDIR)/$1-reass.bin: $(WORKDIR)/$1-reass.s $(DIFF)
$(WORKDIR)/$1-reass.bin: $(WORKDIR)/$1-reass.s $(ISEQUAL)
$(if $(QUIET),echo dasm/$1-reass.bin)
$(CL65) --cpu $1 -t none $(START) -o $$@ $$<
$(DIFF) $$@ $(WORKDIR)/$1-disass.bin
$(ISEQUAL) $$@ $(WORKDIR)/$1-disass.bin
endef # DISASS_template
@ -66,4 +64,3 @@ $(foreach cpu,$(CPUS),$(eval $(call DISASS_template,$(cpu))))
clean:
@$(call RMDIR,$(WORKDIR))
@$(call DEL,$(SOURCES:.s=.o))

View File

@ -11,7 +11,6 @@ ifdef CMD_EXE
NULLDEV = nul:
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
else
S = /
NOT = !
@ -19,7 +18,6 @@ else
NULLDEV = /dev/null
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1
endif
ifdef QUIET
@ -30,14 +28,16 @@ endif
SIM65FLAGS = -x 200000000
CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65)
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)
LD65 := $(if $(wildcard ../../bin/ld65*),..$S..$Sbin$Sld65,ld65)
SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
WORKDIR = ..$S..$Stestwrk$Smisc
OPTIONS = g O Os Osi Osir Osr Oi Oir Or
DIFF = $(WORKDIR)$Sisequal$(EXE)
ISEQUAL = $(WORKDIR)$Sisequal$(EXE)
CC = gcc
CFLAGS = -O2
@ -50,15 +50,10 @@ TESTS += $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).65c02.
all: $(TESTS)
# The same input file is processed with different cl65 args,
# but cl65 uses the input file name to make the temp file name,
# and they stomp each other.
.NOTPARALLEL:
$(WORKDIR):
$(call MKDIR,$(WORKDIR))
$(DIFF): ../isequal.c | $(WORKDIR)
$(ISEQUAL): ../isequal.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $@ $<
define PRG_template
@ -67,61 +62,65 @@ define PRG_template
$(WORKDIR)/bug250.$1.$2.prg: bug250.c | $(WORKDIR)
@echo "FIXME: " $$@ "currently does not compile."
$(if $(QUIET),echo misc/bug250.$1.$2.prg)
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
# should compile, but gives an error
$(WORKDIR)/bug760.$1.$2.prg: bug760.c | $(WORKDIR)
@echo "FIXME: " $$@ "currently does not compile."
$(if $(QUIET),echo misc/bug760.$1.$2.prg)
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
# should compile, but gives an error
$(WORKDIR)/bug1209-ind-goto-rev.$1.$2.prg: bug1209-ind-goto-rev.c | $(WORKDIR)
@echo "FIXME: " $$@ "currently does not compile."
$(if $(QUIET),echo misc/bug1209-ind-goto-rev.$1.$2.prg)
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
# should compile, but gives an error
$(WORKDIR)/bug1209-ind-goto-rev-2.$1.$2.prg: bug1209-ind-goto-rev-2.c | $(WORKDIR)
@echo "FIXME: " $$@ "currently does not compile."
$(if $(QUIET),echo misc/bug1209-ind-goto-rev-2.$1.$2.prg)
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
# should compile, but gives an error
$(WORKDIR)/bug1209-ind-goto-rev-3.$1.$2.prg: bug1209-ind-goto-rev-3.c | $(WORKDIR)
@echo "FIXME: " $$@ "currently does not compile."
$(if $(QUIET),echo misc/bug1209-ind-goto-rev-3.$1.$2.prg)
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
# should compile, but gives an error
$(WORKDIR)/pptest2.$1.$2.prg: pptest2.c | $(WORKDIR)
@echo "FIXME: " $$@ "currently does not compile."
$(if $(QUIET),echo misc/pptest2.$1.$2.prg)
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
# should compile, but then hangs in an endless loop
$(WORKDIR)/endless.$1.$2.prg: endless.c | $(WORKDIR)
$(if $(QUIET),echo misc/endless.$1.$2.prg)
$(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
$(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
$(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
$(NOT) $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT) $(NULLERR)
# these need reference data that can't be generated by a host-compiled program,
# in a useful way
$(WORKDIR)/limits.$1.$2.prg: limits.c $(DIFF) | $(WORKDIR)
$(WORKDIR)/limits.$1.$2.prg: limits.c $(ISEQUAL) | $(WORKDIR)
$(if $(QUIET),echo misc/limits.$1.$2.prg)
$(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
$(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
$(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
$(SIM65) $(SIM65FLAGS) $$@ > $(WORKDIR)/limits.$1.$2.out
$(DIFF) $(WORKDIR)/limits.$1.$2.out limits.ref
$(ISEQUAL) $(WORKDIR)/limits.$1.$2.out limits.ref
$(WORKDIR)/goto.$1.$2.prg: goto.c $(DIFF) | $(WORKDIR)
$(WORKDIR)/goto.$1.$2.prg: goto.c $(ISEQUAL) | $(WORKDIR)
$(if $(QUIET),echo misc/goto.$1.$2.prg)
$(CL65) -t sim$2 -$1 -o $$@ $$< 2>$(WORKDIR)/goto.$1.$2.out
$(DIFF) $(WORKDIR)/goto.$1.$2.out goto.ref
$(CC65) -t sim$2 -$1 -o $$@ $$< 2>$(WORKDIR)/goto.$1.$2.out
$(ISEQUAL) $(WORKDIR)/goto.$1.$2.out goto.ref
# the rest are tests that fail currently for one reason or another
$(WORKDIR)/sitest.$1.$2.prg: sitest.c | $(WORKDIR)
@echo "FIXME: " $$@ "currently does not compile."
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
# $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT)
endef # PRG_template
@ -131,4 +130,3 @@ $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
clean:
@$(call RMDIR,$(WORKDIR))
@$(call DEL,$(SOURCES:.c=.o))

View File

@ -11,14 +11,12 @@ ifdef CMD_EXE
NULLDEV = nul:
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
else
S = /
EXE =
NULLDEV = /dev/null
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1
endif
ifdef QUIET
@ -28,14 +26,16 @@ endif
SIM65FLAGS = -x 200000000
CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65)
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)
LD65 := $(if $(wildcard ../../bin/ld65*),..$S..$Sbin$Sld65,ld65)
SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
WORKDIR = ..$S..$Stestwrk$Sref
OPTIONS = g O Os Osi Osir Osr Oi Oir Or
DIFF = $(WORKDIR)$Sisequal$(EXE)
ISEQUAL = $(WORKDIR)$Sisequal$(EXE)
CC = gcc
CFLAGS = -O2 -Wall -W -Wextra -funsigned-char -fwrapv -fno-strict-overflow
@ -57,7 +57,7 @@ $(WORKDIR)/%.ref: %.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $(WORKDIR)/$*.host $< $(NULLERR)
$(WORKDIR)$S$*.host > $@
$(DIFF): ../isequal.c | $(WORKDIR)
$(ISEQUAL): ../isequal.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $@ $<
# "yaccdbg.c" includes "yacc.c".
@ -68,11 +68,13 @@ $(WORKDIR)/yaccdbg.%.prg: yacc.c
define PRG_template
$(WORKDIR)/%.$1.$2.prg: %.c $(WORKDIR)/%.ref $(DIFF)
$(WORKDIR)/%.$1.$2.prg: %.c $(WORKDIR)/%.ref $(ISEQUAL)
$(if $(QUIET),echo ref/$$*.$1.$2.prg)
$(CL65) -t sim$2 $$(CC65FLAGS) -$1 -o $$@ $$< $(NULLERR)
$(CC65) -t sim$2 $$(CC65FLAGS) -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
$(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
$(SIM65) $(SIM65FLAGS) $$@ > $(WORKDIR)/$$*.$1.$2.out
$(DIFF) $(WORKDIR)/$$*.$1.$2.out $(WORKDIR)/$$*.ref
$(ISEQUAL) $(WORKDIR)/$$*.$1.$2.out $(WORKDIR)/$$*.ref
endef # PRG_template
@ -81,4 +83,3 @@ $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
clean:
@$(call RMDIR,$(WORKDIR))
@$(call DEL,$(SOURCES:.c=.o))

View File

@ -10,14 +10,12 @@ ifdef CMD_EXE
NULLDEV = nul:
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
else
S = /
NOT = !
NULLDEV = /dev/null
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1
endif
ifdef QUIET
@ -28,7 +26,9 @@ endif
SIM65FLAGS = -x 200000000
CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65)
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)
LD65 := $(if $(wildcard ../../bin/ld65*),..$S..$Sbin$Sld65,ld65)
SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
WORKDIR = ../../testwrk/val
@ -50,7 +50,9 @@ define PRG_template
$(WORKDIR)/%.$1.$2.prg: %.c | $(WORKDIR)
$(if $(QUIET),echo val/$$*.$1.$2.prg)
$(CL65) -t sim$2 $$(CC65FLAGS) -$1 -o $$@ $$< $(NULLERR)
$(CC65) -t sim$2 $$(CC65FLAGS) -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
$(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
$(NOT) $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT)
endef # PRG_template
@ -60,4 +62,3 @@ $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
clean:
@$(call RMDIR,$(WORKDIR))
@$(call DEL,$(SOURCES:.c=.o))

View File

@ -9,13 +9,11 @@ ifdef CMD_EXE
NULLDEV = nul:
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
else
S = /
NULLDEV = /dev/null
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1
endif
ifdef QUIET
@ -26,7 +24,9 @@ endif
SIM65FLAGS = -x 5000000000
CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65)
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)
LD65 := $(if $(wildcard ../../bin/ld65*),..$S..$Sbin$Sld65,ld65)
SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
WORKDIR = ../../testwrk/val
@ -41,11 +41,6 @@ TESTS += $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).65c02.
all: $(TESTS)
# The same input file is processed with different cl65 args,
# but cl65 uses the input file name to make the temp file name,
# and they stomp each other.
.NOTPARALLEL:
$(WORKDIR):
$(call MKDIR,$(WORKDIR))
@ -53,7 +48,9 @@ define PRG_template
$(WORKDIR)/%.$1.$2.prg: %.c | $(WORKDIR)
$(if $(QUIET),echo val/$$*.$1.$2.prg)
$(CL65) -t sim$2 $$(CC65FLAGS) -$1 -o $$@ $$< $(NULLERR)
$(CC65) -t sim$2 $$(CC65FLAGS) -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
$(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
$(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT)
endef # PRG_template
@ -63,4 +60,3 @@ $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
clean:
@$(call RMDIR,$(WORKDIR))
@$(call DEL,$(SOURCES:.c=.o))