From 81cced4d83a388c387695a8a5477ff35e613e527 Mon Sep 17 00:00:00 2001
From: Peter0x44 <peter0x44@snopyta.org>
Date: Thu, 10 Feb 2022 19:52:34 +0000
Subject: [PATCH] Fix make clean target failing when shell is not cmd (#2338)

GNU make on Windows first tries to find sh.exe on the path,
and will execute build rules using it if it is present.
The make clean target uses the builtin cmd.exe command del, which
won't work under sh.exe

The reason this is not done for the entire Makefile is because it would
break cross-compilation of raylib.
---
 src/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/Makefile b/src/Makefile
index ddac896cb..3048f98a4 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -731,6 +731,12 @@ endif
 # Clean everything
 clean:
 ifeq ($(PLATFORM_OS),WINDOWS)
+	# Make always tries to run build rules under sh.exe by default
+	# So if sh.exe is present in the PATH on windows, the del commands will fail
+	# see README.W32 of GNU Make for more details
+	# It is not specified earlier in the Makefile, because then cross-compilation
+	# will also fail.
+	SHELL = cmd
 	del *.o /s
 	cd $(RAYLIB_RELEASE_PATH)
 	del lib$(RAYLIB_LIB_NAME).a /s