From b9c1087cc2febf5789f7bc59dc9ff52f50ce3b3b Mon Sep 17 00:00:00 2001 From: Greg King Date: Wed, 17 Dec 2014 11:57:45 -0500 Subject: [PATCH 1/7] Added make code to build the optimized versions. --- test/misc/Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/misc/Makefile b/test/misc/Makefile index b18d9165e..bb9fa404b 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -33,30 +33,28 @@ TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) -# FIXME: actually use/build differently optimized programs here - all: $(TESTS) # should compile, but then hangs in an endless loop $(WORKDIR)/endless%prg: endless.c - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ ! $(SIM65) $(SIM65FLAGS) $@ # these need reference data that cant be generated by a host compiled program # in a useful way $(WORKDIR)/limits%prg: limits.c - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/limits.out $(DIFF) $(WORKDIR)/limits.out limits.ref # the rest are tests that fail currently for one reason or another $(WORKDIR)/fields%prg: fields.c @echo "FIXME: " $@ "will currently fail" - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ -$(SIM65) $(SIM65FLAGS) $@ $(WORKDIR)/sitest%prg: sitest.c @echo "FIXME: " $@ "will currently fail" - -$(CL65) $(CC65FLAGS) $< -o $@ + -$(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ -$(SIM65) $(SIM65FLAGS) $@ clean: From ad56b6abe94129d014f62eab5a51d6e3e61bb5d5 Mon Sep 17 00:00:00 2001 From: Greg King Date: Wed, 17 Dec 2014 15:59:29 -0500 Subject: [PATCH 2/7] Made the makefiles' clean target remove the object files from the source directory. --- test/err/Makefile | 2 +- test/misc/Makefile | 2 +- test/ref/Makefile | 2 +- test/val/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/err/Makefile b/test/err/Makefile index 40ccfcb59..a6d590515 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -49,4 +49,4 @@ $(WORKDIR)/%.or.prg: %.c ! $(CL65) -Or $(CC65FLAGS) $< -o $@ clean: @$(RM) $(TESTS) - @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) + @$(RM) $(SOURCES:.c=.o) diff --git a/test/misc/Makefile b/test/misc/Makefile index bb9fa404b..7af8c0cb1 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -59,7 +59,7 @@ $(WORKDIR)/sitest%prg: sitest.c clean: @$(RM) $(TESTS) - @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) + @$(RM) $(SOURCES:.c=.o) @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out) diff --git a/test/ref/Makefile b/test/ref/Makefile index b752adc1d..39336aa52 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -86,7 +86,7 @@ $(WORKDIR)/%.or.prg: %.c $(WORKDIR)/%.ref clean: @$(RM) $(TESTS) - @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) + @$(RM) $(SOURCES:.c=.o) @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out) @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.ref) @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.host) diff --git a/test/val/Makefile b/test/val/Makefile index 2e0aca278..c9afbbd86 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -67,4 +67,4 @@ $(WORKDIR)/%.or.prg: %.c clean: @$(RM) $(TESTS) - @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) + @$(RM) $(SOURCES:.c=.o) From d9c8c1de457e2b8964c2828fbf2fdd0988e17de2 Mon Sep 17 00:00:00 2001 From: Greg King Date: Wed, 17 Dec 2014 16:30:09 -0500 Subject: [PATCH 3/7] Create the makefile variable REFS in the same way that TESTS is made. --- test/err/Makefile | 1 + test/misc/Makefile | 3 +-- test/ref/Makefile | 5 +++-- test/val/Makefile | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/err/Makefile b/test/err/Makefile index a6d590515..46ce4c9cc 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -20,6 +20,7 @@ WORKDIR := ./../../testwrk .PHONY: all clean SOURCES := $(wildcard *.c) + TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) diff --git a/test/misc/Makefile b/test/misc/Makefile index 7af8c0cb1..64fcc8759 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -24,6 +24,7 @@ DIFF := $(WORKDIR)/bdiff .PHONY: all clean SOURCES := $(wildcard *.c) + TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) @@ -61,5 +62,3 @@ clean: @$(RM) $(TESTS) @$(RM) $(SOURCES:.c=.o) @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out) - - diff --git a/test/ref/Makefile b/test/ref/Makefile index 39336aa52..df13a28cc 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -26,9 +26,10 @@ CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow .PHONY: all clean -REFS := $(patsubst %.c,$(WORKDIR)/%.ref,$(wildcard *.c)) - SOURCES := $(wildcard *.c) + +REFS := $(SOURCES:%.c=$(WORKDIR)/%.ref) + TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) diff --git a/test/val/Makefile b/test/val/Makefile index c9afbbd86..f4e0d28b2 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -22,6 +22,7 @@ WORKDIR := ./../../testwrk .PHONY: all clean SOURCES := $(wildcard *.c) + TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) From 15a22bd1c819f6f82dca15bee379741561ba6389 Mon Sep 17 00:00:00 2001 From: Greg King Date: Wed, 17 Dec 2014 17:35:18 -0500 Subject: [PATCH 4/7] All regression-tests subdirectories are cleaned before the first test starts, so that 'make continue' won't see debris when it moves to the next directory. --- test/Makefile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/Makefile b/test/Makefile index b942cbcdf..579fc8b92 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,7 +1,9 @@ # toplevel makefile for the regression tests -MAKE := make --no-print-dir +# You can comment this special target when you debug the regression tests. +# Then, make will give you more progress reports. +.SILENT: ifneq ($(shell echo),) CMD_EXE = 1 @@ -21,21 +23,17 @@ endif WORKDIR := ../testwrk -.PHONY: dotests clean +.PHONY: all dotests continue mostly-clean clean all: dotests $(WORKDIR): - @$(MKDIR) $(WORKDIR) + $(MKDIR) $(WORKDIR) -$(WORKDIR)/bdiff$(EXE): $(WORKDIR) - @$(CC) -o $(WORKDIR)/bdiff$(EXE) bdiff.c +$(WORKDIR)/bdiff$(EXE): bdiff.c | $(WORKDIR) + $(CC) -O2 -o $@ $< -dotests: $(WORKDIR)/bdiff$(EXE) - @$(MAKE) -C val clean all - @$(MAKE) -C ref clean all - @$(MAKE) -C err clean all - @$(MAKE) -C misc clean all +dotests: mostly-clean continue continue: $(WORKDIR)/bdiff$(EXE) @$(MAKE) -C val all @@ -43,10 +41,12 @@ continue: $(WORKDIR)/bdiff$(EXE) @$(MAKE) -C err all @$(MAKE) -C misc all -clean: +mostly-clean: @$(MAKE) -C val clean @$(MAKE) -C ref clean @$(MAKE) -C err clean @$(MAKE) -C misc clean - @$(RM) $(WORKDIR)/bdiff$(EXE) - @$(RMDIR) $(WORKDIR) + +clean: mostly-clean + $(RM) $(WORKDIR)/bdiff$(EXE) + $(RMDIR) $(WORKDIR) From e414e89b64e4e9318d6b4588bdeeaa8d8c722d22 Mon Sep 17 00:00:00 2001 From: Greg King Date: Wed, 17 Dec 2014 17:44:39 -0500 Subject: [PATCH 5/7] Use simply-defined make variables. --- test/Makefile | 12 ++++++------ test/err/Makefile | 7 ++++--- test/misc/Makefile | 16 ++++++++-------- test/ref/Makefile | 8 ++++---- test/val/Makefile | 8 ++++---- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/test/Makefile b/test/Makefile index 579fc8b92..0f96a38f8 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,24 +1,24 @@ -# toplevel makefile for the regression tests +# top-level makefile for the regression tests # You can comment this special target when you debug the regression tests. # Then, make will give you more progress reports. .SILENT: ifneq ($(shell echo),) - CMD_EXE = 1 + CMD_EXE := 1 endif ifdef CMD_EXE RM := del /f EXE := .exe - MKDIR = mkdir - RMDIR = rmdir + MKDIR := mkdir + RMDIR := rmdir else RM := rm -f EXE := - MKDIR = mkdir -p - RMDIR = rmdir + MKDIR := mkdir -p + RMDIR := rmdir endif WORKDIR := ../testwrk diff --git a/test/err/Makefile b/test/err/Makefile index 46ce4c9cc..29c47ef3e 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -2,10 +2,10 @@ # makefile for the tests that MUST NOT compile ifneq ($(shell echo),) - CMD_EXE = 1 + CMD_EXE := 1 endif -CC65FLAGS = -t sim6502 +CC65FLAGS := -t sim6502 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) @@ -15,7 +15,7 @@ else RM := rm -f endif -WORKDIR := ./../../testwrk +WORKDIR := ../../testwrk .PHONY: all clean @@ -48,6 +48,7 @@ $(WORKDIR)/%.oir.prg: %.c ! $(CL65) -Oir $(CC65FLAGS) $< -o $@ $(WORKDIR)/%.or.prg: %.c ! $(CL65) -Or $(CC65FLAGS) $< -o $@ + clean: @$(RM) $(TESTS) @$(RM) $(SOURCES:.c=.o) diff --git a/test/misc/Makefile b/test/misc/Makefile index 64fcc8759..c473f5f85 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -2,11 +2,11 @@ # makefile for the remaining tests that need special care in one way or another ifneq ($(shell echo),) - CMD_EXE = 1 + CMD_EXE := 1 endif -CC65FLAGS = -t sim6502 -SIM65FLAGS = -x 200000000 +CC65FLAGS := -t sim6502 +SIM65FLAGS := -x 200000000 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) @@ -17,7 +17,7 @@ else RM := rm -f endif -WORKDIR := ./../../testwrk +WORKDIR := ../../testwrk DIFF := $(WORKDIR)/bdiff @@ -41,7 +41,7 @@ $(WORKDIR)/endless%prg: endless.c $(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ ! $(SIM65) $(SIM65FLAGS) $@ -# these need reference data that cant 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 $(WORKDIR)/limits%prg: limits.c $(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ @@ -50,13 +50,13 @@ $(WORKDIR)/limits%prg: limits.c # the rest are tests that fail currently for one reason or another $(WORKDIR)/fields%prg: fields.c - @echo "FIXME: " $@ "will currently fail" + @echo "FIXME: " $@ "currently will fail." $(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ -$(SIM65) $(SIM65FLAGS) $@ $(WORKDIR)/sitest%prg: sitest.c - @echo "FIXME: " $@ "will currently fail" + @echo "FIXME: " $@ "currently will fail." -$(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ - -$(SIM65) $(SIM65FLAGS) $@ +# -$(SIM65) $(SIM65FLAGS) $@ clean: @$(RM) $(TESTS) diff --git a/test/ref/Makefile b/test/ref/Makefile index df13a28cc..66ff94e28 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -3,11 +3,11 @@ # compared with reference output ifneq ($(shell echo),) - CMD_EXE = 1 + CMD_EXE := 1 endif -CC65FLAGS = -t sim6502 -SIM65FLAGS = -x 200000000 +CC65FLAGS := -t sim6502 +SIM65FLAGS := -x 200000000 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) @@ -18,7 +18,7 @@ else RM := rm -f endif -WORKDIR := ./../../testwrk +WORKDIR := ../../testwrk DIFF := $(WORKDIR)/bdiff diff --git a/test/val/Makefile b/test/val/Makefile index f4e0d28b2..bd88797e5 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -2,11 +2,11 @@ # makefile for the regression tests that return an error code on failure ifneq ($(shell echo),) - CMD_EXE = 1 + CMD_EXE := 1 endif -CC65FLAGS = -t sim6502 -SIM65FLAGS = -x 200000000 +CC65FLAGS := -t sim6502 +SIM65FLAGS := -x 200000000 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) @@ -17,7 +17,7 @@ else RM := rm -f endif -WORKDIR := ./../../testwrk +WORKDIR := ../../testwrk .PHONY: all clean From 244eeedcfc82c2582e057a46c61d58a5e9b6e631 Mon Sep 17 00:00:00 2001 From: Greg King Date: Thu, 18 Dec 2014 14:15:24 -0500 Subject: [PATCH 6/7] Shortenned the code that creates the TESTS make variable. And, fixed the variable-substitution that creates the CC65 optimization option. --- test/err/Makefile | 10 +--------- test/misc/Makefile | 18 +++++------------- test/ref/Makefile | 11 +---------- test/val/Makefile | 10 +--------- 4 files changed, 8 insertions(+), 41 deletions(-) diff --git a/test/err/Makefile b/test/err/Makefile index 29c47ef3e..4e12323fd 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -20,15 +20,7 @@ WORKDIR := ../../testwrk .PHONY: all clean SOURCES := $(wildcard *.c) - -TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) +TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg)) all: $(TESTS) diff --git a/test/misc/Makefile b/test/misc/Makefile index c473f5f85..b04321c33 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -24,38 +24,30 @@ DIFF := $(WORKDIR)/bdiff .PHONY: all clean SOURCES := $(wildcard *.c) - -TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) +TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg)) all: $(TESTS) # should compile, but then hangs in an endless loop $(WORKDIR)/endless%prg: endless.c - $(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ + $(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@ ! $(SIM65) $(SIM65FLAGS) $@ # these need reference data that can't be generated by a host-compiled program, # in a useful way $(WORKDIR)/limits%prg: limits.c - $(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ + $(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/limits.out $(DIFF) $(WORKDIR)/limits.out limits.ref # the rest are tests that fail currently for one reason or another $(WORKDIR)/fields%prg: fields.c @echo "FIXME: " $@ "currently will fail." - $(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ + $(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@ -$(SIM65) $(SIM65FLAGS) $@ $(WORKDIR)/sitest%prg: sitest.c @echo "FIXME: " $@ "currently will fail." - -$(CL65) $(subst .,,($*:.o%=-O%)) $(CC65FLAGS) $< -o $@ + -$(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@ # -$(SIM65) $(SIM65FLAGS) $@ clean: diff --git a/test/ref/Makefile b/test/ref/Makefile index 66ff94e28..3e7a5ad6c 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -27,17 +27,8 @@ CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow .PHONY: all clean SOURCES := $(wildcard *.c) - REFS := $(SOURCES:%.c=$(WORKDIR)/%.ref) - -TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) +TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg)) all: $(REFS) $(TESTS) diff --git a/test/val/Makefile b/test/val/Makefile index bd88797e5..2efcbd0de 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -22,15 +22,7 @@ WORKDIR := ../../testwrk .PHONY: all clean SOURCES := $(wildcard *.c) - -TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) -TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) +TESTS := $(foreach option,. .o. .os. .osi. .osir. .oi. .oir. .or.,$(SOURCES:%.c=$(WORKDIR)/%$(option)prg)) all: $(TESTS) From 1a0a872bd6a6ac19b5e14231696bf6a8f14944cf Mon Sep 17 00:00:00 2001 From: Greg King Date: Thu, 18 Dec 2014 14:30:35 -0500 Subject: [PATCH 7/7] Made sure that parallel-building the regression-tests doesn't start a test before all of the directories are clean. --- test/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Makefile b/test/Makefile index 0f96a38f8..27f7ff456 100644 --- a/test/Makefile +++ b/test/Makefile @@ -33,6 +33,8 @@ $(WORKDIR): $(WORKDIR)/bdiff$(EXE): bdiff.c | $(WORKDIR) $(CC) -O2 -o $@ $< +.NOTPARALLEL: + dotests: mostly-clean continue continue: $(WORKDIR)/bdiff$(EXE)