Windows: Support building with SHELL=cmd.exe
authorSimon Richter <Simon.Richter@hogyros.de>
Mon, 11 Feb 2019 15:51:35 +0000 (16:51 +0100)
committerMatt Turner <mattst88@gmail.com>
Wed, 27 Mar 2019 22:12:52 +0000 (15:12 -0700)
When GNU Make is not from msys, the startup cost for sh.exe is massive
compared to cmd.exe.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Makefile.win32.common

index 0048cf82d25c49fb5210956bfaf3df6dba26e8f7..1b2f894873d736364d3c52009727e1a40a75f47e 100644 (file)
@@ -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