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

Simon Richter Simon.Richter at hogyros.de
Mon Feb 11 15:51:35 UTC 2019


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(-)

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
-- 
2.11.0



More information about the Pixman mailing list