From 6970053023524caf75ad9b9873acbd320c1c3c87 Mon Sep 17 00:00:00 2001
From: mrdudz <mrdudz@users.noreply.github.com>
Date: Fri, 10 Jul 2015 10:43:00 +0200
Subject: [PATCH 1/3] use rm -r instead of rmdir, and use -f for rm, that makes
 subsequent runs of "make clean" not fail

---
 test/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/Makefile b/test/Makefile
index 8c005a957..d2ad2ee94 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -16,9 +16,9 @@ ifdef CMD_EXE
   RMDIR = rmdir /s /q $(subst /,\,$1)
 else
   EXE :=
-  DEL = $(RM) $1
+  DEL = $(RM) -f $1
   MKDIR = mkdir $1
-  RMDIR = rmdir $1
+  RMDIR = $(RM) -rf $1
 endif
 
 WORKDIR := ../testwrk

From ad97b1b08e0e389a12bdb998afc1402bac7f0aa6 Mon Sep 17 00:00:00 2001
From: mrdudz <mrdudz@users.noreply.github.com>
Date: Fri, 10 Jul 2015 11:11:41 +0200
Subject: [PATCH 2/3] removed -f again, as that is the default. also removed
 "-" before the actual comments, which were the workaround previously

---
 test/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/Makefile b/test/Makefile
index d2ad2ee94..eb968095a 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -16,9 +16,9 @@ ifdef CMD_EXE
   RMDIR = rmdir /s /q $(subst /,\,$1)
 else
   EXE :=
-  DEL = $(RM) -f $1
+  DEL = $(RM) $1
   MKDIR = mkdir $1
-  RMDIR = $(RM) -rf $1
+  RMDIR = $(RM) -r $1
 endif
 
 WORKDIR := ../testwrk
@@ -52,5 +52,5 @@ mostly-clean:
 	@$(MAKE) -C misc clean
 
 clean: mostly-clean
-	-@$(call DEL,$(WORKDIR)/bdiff$(EXE))
-	-@$(call RMDIR,$(WORKDIR))
+	@$(call DEL,$(WORKDIR)/bdiff$(EXE))
+	@$(call RMDIR,$(WORKDIR))

From 1380c68cf3e9a59677c53cec057fcbbf4c580b2a Mon Sep 17 00:00:00 2001
From: mrdudz <mrdudz@users.noreply.github.com>
Date: Fri, 10 Jul 2015 20:04:31 +0200
Subject: [PATCH 3/3] workaround for cmd.exe rmdir

---
 test/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/Makefile b/test/Makefile
index eb968095a..c13f2212d 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -13,7 +13,8 @@ ifdef CMD_EXE
   EXE := .exe
   DEL = del /f $(subst /,\,$1)
   MKDIR = mkdir $(subst /,\,$1)
-  RMDIR = rmdir /s /q $(subst /,\,$1)
+  DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
+  RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
 else
   EXE :=
   DEL = $(RM) $1