[2/2] Windows: Support building with SHELL=cmd.exe

Submitted by Simon Richter on Feb. 11, 2019, 3:51 p.m.

Details

Message ID 20190211155135.24353-2-Simon.Richter@hogyros.de
State New
Series "Series without cover letter"
Headers show

Commit Message

Simon Richter Feb. 11, 2019, 3:51 p.m.
When GNU Make is not from msys, the startup cost for sh.exe is massive
compared to cmd.exe.
---
 Makefile.win32.common | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/Makefile.win32.common b/Makefile.win32.common
index 0048cf8..1b2f894 100644
--- a/Makefile.win32.common
+++ b/Makefile.win32.common
@@ -1,5 +1,17 @@ 
 LIBRARY = pixman-1
 
+ifeq ($(shell echo ""),)
+# POSIX style shell
+mkdir_p = mkdir -p $1
+rm = $(RM) $1
+echo = echo "$1"
+else
+# DOS/Windows style shell
+mkdir_p = if not exist $(subst /,\,$1) md $(subst /,\,$1)
+echo = echo $1
+rm = del $(subst /,\,$1)
+endif
+
 CC = cl
 LD = link
 AR = lib
@@ -50,12 +62,12 @@  endif
 endif
 
 $(CFG_VAR):
-	@mkdir $@
+	@$(call mkdir_p,$@)
 
 $(CFG_VAR)/%.obj: %.c $(libpixman_headers) | $(CFG_VAR)
 	$(CC) -c $(PIXMAN_CFLAGS) -Fo"$@" $<
 
 clean: inform $(CFG_VAR)
-	@cd $(CFG_VAR) && echo > silence_error.exe && $(RM) *.exe *.ilk *.lib *.obj *.pdb
+	-$(call rm,$(CFG_VAR)/*.exe $(CFG_VAR)/*.ilk $(CFG_VAR)/*.lib $(CFG_VAR)/*.obj $(CFG_VAR)/*.pdb)
 
 .PHONY: inform clean