.PHONY: all clean
 
 all:
-       @$(MAKE) -C val all
-       @$(MAKE) -C ref all
-       @$(MAKE) -C err all
-       @$(MAKE) -C misc all
+       @$(MAKE) -C val clean all
+       @$(MAKE) -C ref clean all
+       @$(MAKE) -C err clean all
+       @$(MAKE) -C misc clean all
 
 clean:
        @$(MAKE) -C val clean
 
 
 # makefile for the tests that MUST NOT compile
 
+ifneq ($(shell echo),)
+  CMD_EXE = 1
+endif
+
 CC65FLAGS = -t sim6502
 
 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
-SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
 
+ifdef CMD_EXE
+RM := del /f
+else
 RM := rm -f
+endif
 
-.PHONY: all
+.PHONY: all clean
 
 TESTS := $(patsubst %.c,%.prg,$(wildcard *.c))
 TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c))
 
 
+# makefile for the remaining tests that need special care in one way or another
+
+ifneq ($(shell echo),)
+  CMD_EXE = 1
+endif
+
 CC65FLAGS = -t sim6502
 SIM65FLAGS = -x 200000000
 
 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
 SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
 
+ifdef CMD_EXE
+RM := del /f
+DIFF := fc
+else
 RM := rm -f
 DIFF := diff -q
+endif
 
-.PHONY: all
+.PHONY: all clean
 
 TESTS := $(patsubst %.c,%.prg,$(wildcard *.c))
 TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c))
 
 /misc - a few tests that need special care of some sort
 
 
-to run the tests use "make clean all" in this (top) directory, the makefile
-should exit with no error.
+to run the tests use "make" in this (top) directory, the makefile should exit
+with no error.
 
 # makefile for the regression tests that generate output which has to be
 # compared with reference output
 
+ifneq ($(shell echo),)
+  CMD_EXE = 1
+endif
+
 CC65FLAGS = -t sim6502
 SIM65FLAGS = -x 200000000
 
 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
 SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
 
+ifdef CMD_EXE
+RM := del /f
+DIFF := fc
+else
 RM := rm -f
 DIFF := diff -q
+endif
 
 CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow
 
-.PHONY: all
+.PHONY: all clean
 
 REFS := $(patsubst %.c,%.ref,$(wildcard *.c))
 
 
 
-- the tests in ./misc need special care
-
 - check all tests in ./ref and make them return their results as exit code
 
-- in ./val use some other tool than "diff" for comparing the results
-
-- fixup makefiles to use "del" instead of "rm -f" on windows
-
 - reduce usage of "common.h" to a minimum
 
 
 # makefile for the regression tests that return an error code on failure
 
+ifneq ($(shell echo),)
+  CMD_EXE = 1
+endif
+
 CC65FLAGS = -t sim6502
 SIM65FLAGS = -x 200000000
 
 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
 SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
 
+ifdef CMD_EXE
+RM := del /f
+else
 RM := rm -f
+endif
 
-.PHONY: all
+.PHONY: all clean
 
 TESTS := $(patsubst %.c,%.prg,$(wildcard *.c))
 TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c))