[cairo] [PATCH 3/3] Windows: support building with SHELL=cmd.exe

Simon Richter Simon.Richter at hogyros.de
Fri Dec 20 12:39:16 UTC 2019


---
 build/Makefile.win32.common     | 18 +++++-
 build/Makefile.win32.features-h | 98 ++++++++++++++++-----------------
 build/Makefile.win32.inform     | 14 ++---
 build/configure.ac.features     | 12 ++--
 src/Makefile.win32              | 21 ++++---
 5 files changed, 90 insertions(+), 73 deletions(-)

diff --git a/build/Makefile.win32.common b/build/Makefile.win32.common
index 43d9e9e85..6b9ec55ba 100644
--- a/build/Makefile.win32.common
+++ b/build/Makefile.win32.common
@@ -1,5 +1,17 @@
 default: all
 
+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 = $(if $1,echo $1,echo.)
+rm = del $(subst /,\,$1)
+endif
+
 #
 # Edit build/Makefile.win32.features to enable features to build
 #
@@ -63,12 +75,12 @@ CAIRO_ARFLAGS = $(DEFAULT_ARFLAGS) $(LDFLAGS)
 # Some generic rules
 
 $(CFG)/%.obj: %.c $(top_srcdir)/src/cairo-features.h
-	@mkdir -p $(CFG)/`dirname $<`
+	$(call mkdir_p,$(@D))
 	$(CC) $(CAIRO_CFLAGS) -c -Fo"$@" $<
 
 $(CFG)/%-static.obj: %.c $(top_srcdir)/src/cairo-features.h
-	@mkdir -p $(CFG)/`dirname $<`
+	$(call mkdir_p,$(@D))
 	$(CC) $(CAIRO_CFLAGS) -c -DCAIRO_WIN32_STATIC_BUILD=1 -Fo"$@" $<
 
 clean:
-	@rm -f $(CFG)/*.obj $(CFG)/*.dll $(CFG)/*.lib $(CFG)/*.pdb $(CFG)/*.ilk || exit 0
+	-$(call rm,$(CFG)/*.obj $(CFG)/*.dll $(CFG)/*.lib $(CFG)/*.pdb $(CFG)/*.ilk)
diff --git a/build/Makefile.win32.features-h b/build/Makefile.win32.features-h
index 5759b48a3..59867d213 100644
--- a/build/Makefile.win32.features-h
+++ b/build/Makefile.win32.features-h
@@ -1,130 +1,130 @@
 # Generated by configure.  Do not edit.
 
 $(top_srcdir)/src/cairo-features.h: $(top_srcdir)/build/Makefile.win32.features
-	@echo "Generating src/cairo-features.h"
-	@echo "/* Generated by Makefile.win32.features-h.  Do not edit. */" > $(top_srcdir)/src/cairo-features.h
-	@echo "#ifndef CAIRO_FEATURES_H" >> $(top_srcdir)/src/cairo-features.h
-	@echo "#define CAIRO_FEATURES_H 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,Generating src/cairo-features.h)
+	@$(call echo,/* Generated by Makefile.win32.features-h.  Do not edit. */) > $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#ifndef CAIRO_FEATURES_H) >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_FEATURES_H 1) >> $(top_srcdir)/src/cairo-features.h
 ifeq ($(CAIRO_HAS_XLIB_SURFACE),1)
-	@echo "#define CAIRO_HAS_XLIB_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_XLIB_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_XLIB_XRENDER_SURFACE),1)
-	@echo "#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_XCB_SURFACE),1)
-	@echo "#define CAIRO_HAS_XCB_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_XCB_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_XLIB_XCB_FUNCTIONS),1)
-	@echo "#define CAIRO_HAS_XLIB_XCB_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_XLIB_XCB_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_XCB_SHM_FUNCTIONS),1)
-	@echo "#define CAIRO_HAS_XCB_SHM_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_XCB_SHM_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_QT_SURFACE),1)
-	@echo "#define CAIRO_HAS_QT_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_QT_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_QUARTZ_SURFACE),1)
-	@echo "#define CAIRO_HAS_QUARTZ_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_QUARTZ_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_QUARTZ_FONT),1)
-	@echo "#define CAIRO_HAS_QUARTZ_FONT 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_QUARTZ_FONT 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_QUARTZ_IMAGE_SURFACE),1)
-	@echo "#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_WIN32_SURFACE),1)
-	@echo "#define CAIRO_HAS_WIN32_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_WIN32_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_WIN32_FONT),1)
-	@echo "#define CAIRO_HAS_WIN32_FONT 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_WIN32_FONT 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_OS2_SURFACE),1)
-	@echo "#define CAIRO_HAS_OS2_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_OS2_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_BEOS_SURFACE),1)
-	@echo "#define CAIRO_HAS_BEOS_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_BEOS_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_DRM_SURFACE),1)
-	@echo "#define CAIRO_HAS_DRM_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_DRM_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_GALLIUM_SURFACE),1)
-	@echo "#define CAIRO_HAS_GALLIUM_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_GALLIUM_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_PNG_FUNCTIONS),1)
-	@echo "#define CAIRO_HAS_PNG_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_PNG_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_GL_SURFACE),1)
-	@echo "#define CAIRO_HAS_GL_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_GL_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_GLESV2_SURFACE),1)
-	@echo "#define CAIRO_HAS_GLESV2_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_GLESV2_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_GLESV3_SURFACE),1)
-	@echo "#define CAIRO_HAS_GLESV3_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_GLESV3_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_COGL_SURFACE),1)
-	@echo "#define CAIRO_HAS_COGL_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_COGL_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_DIRECTFB_SURFACE),1)
-	@echo "#define CAIRO_HAS_DIRECTFB_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_DIRECTFB_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_VG_SURFACE),1)
-	@echo "#define CAIRO_HAS_VG_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_VG_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_EGL_FUNCTIONS),1)
-	@echo "#define CAIRO_HAS_EGL_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_EGL_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_GLX_FUNCTIONS),1)
-	@echo "#define CAIRO_HAS_GLX_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_GLX_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_WGL_FUNCTIONS),1)
-	@echo "#define CAIRO_HAS_WGL_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_WGL_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_SCRIPT_SURFACE),1)
-	@echo "#define CAIRO_HAS_SCRIPT_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_SCRIPT_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_FT_FONT),1)
-	@echo "#define CAIRO_HAS_FT_FONT 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_FT_FONT 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_FC_FONT),1)
-	@echo "#define CAIRO_HAS_FC_FONT 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_FC_FONT 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_PS_SURFACE),1)
-	@echo "#define CAIRO_HAS_PS_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_PS_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_PDF_SURFACE),1)
-	@echo "#define CAIRO_HAS_PDF_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_PDF_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_SVG_SURFACE),1)
-	@echo "#define CAIRO_HAS_SVG_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_SVG_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_TEST_SURFACES),1)
-	@echo "#define CAIRO_HAS_TEST_SURFACES 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_TEST_SURFACES 1) >> $(top_srcdir)/src/cairo-features.h
 endif
-	@echo "#define CAIRO_HAS_IMAGE_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
-	@echo "#define CAIRO_HAS_MIME_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
-	@echo "#define CAIRO_HAS_RECORDING_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
-	@echo "#define CAIRO_HAS_OBSERVER_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_IMAGE_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_MIME_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_RECORDING_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_OBSERVER_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 ifeq ($(CAIRO_HAS_TEE_SURFACE),1)
-	@echo "#define CAIRO_HAS_TEE_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_TEE_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_XML_SURFACE),1)
-	@echo "#define CAIRO_HAS_XML_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_XML_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
-	@echo "#define CAIRO_HAS_USER_FONT 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_USER_FONT 1) >> $(top_srcdir)/src/cairo-features.h
 ifeq ($(CAIRO_HAS_PTHREAD),1)
-	@echo "#define CAIRO_HAS_PTHREAD 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_PTHREAD 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_GOBJECT_FUNCTIONS),1)
-	@echo "#define CAIRO_HAS_GOBJECT_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_GOBJECT_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_TRACE),1)
-	@echo "#define CAIRO_HAS_TRACE 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_TRACE 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_INTERPRETER),1)
-	@echo "#define CAIRO_HAS_INTERPRETER 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_INTERPRETER 1) >> $(top_srcdir)/src/cairo-features.h
 endif
 ifeq ($(CAIRO_HAS_SYMBOL_LOOKUP),1)
-	@echo "#define CAIRO_HAS_SYMBOL_LOOKUP 1" >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#define CAIRO_HAS_SYMBOL_LOOKUP 1) >> $(top_srcdir)/src/cairo-features.h
 endif
-	@echo "#endif" >>  $(top_srcdir)/src/cairo-features.h
+	@$(call echo,#endif) >>  $(top_srcdir)/src/cairo-features.h
diff --git a/build/Makefile.win32.inform b/build/Makefile.win32.inform
index ba1116505..99a438c40 100644
--- a/build/Makefile.win32.inform
+++ b/build/Makefile.win32.inform
@@ -1,13 +1,13 @@
 inform:
-	@echo
+	@$(call echo)
 ifneq ($(CFG),release)
 ifneq ($(CFG),debug)
-	@echo "Invalid configuration "$(CFG)" specified."
-	@echo -n "You must specify a configuration when "
-	@echo "running make, e.g. make CFG=debug"
-	@echo
-	@echo -n "Possible choices for configuration are "
-	@echo "'release' and 'debug'"
+	@$(call echo,Invalid configuration "$(CFG)" specified.)
+	@$(call echo,You must specify a configuration when)
+	@$(call echo,running make, e.g. make CFG=debug)
+	@$(call echo)
+	@$(call echo,Possible choices for configuration are)
+	@$(call echo,'release' and 'debug')
 	@exit 1
 endif
 endif
diff --git a/build/configure.ac.features b/build/configure.ac.features
index e0a46069c..7f886e488 100644
--- a/build/configure.ac.features
+++ b/build/configure.ac.features
@@ -296,17 +296,17 @@ CAIRO_CONFIG_MAKEFILE_PRIVATE_WIN32([win32_features_h],[build],[features-h])
 dnl
 CAIRO_MAKEFILE_ACCUMULATE([win32_features_h],
 [$(top_srcdir)/src/cairo-features.h: $(top_srcdir)/build/Makefile.win32.features
-	@echo "Generating src/cairo-features.h"
-	@echo "/* Generated by Makefile.win32.features-h.  Do not edit. */" > $(top_srcdir)/src/cairo-features.h
-	@echo "[#]ifndef CAIRO_FEATURES_H" >> $(top_srcdir)/src/cairo-features.h
-	@echo "[#]define CAIRO_FEATURES_H 1" >> $(top_srcdir)/src/cairo-features.h]dnl
+	@$(call echo,Generating src/cairo-features.h)
+	@$(call echo,/* Generated by Makefile.win32.features-h.  Do not edit. */) > $(top_srcdir)/src/cairo-features.h
+	@$(call echo,[#]ifndef CAIRO_FEATURES_H) >> $(top_srcdir)/src/cairo-features.h
+	@$(call echo,[#]define CAIRO_FEATURES_H 1) >> $(top_srcdir)/src/cairo-features.h]dnl
 )
 AC_CONFIG_COMMANDS_PRE(
 [dnl
-	CAIRO_MAKEFILE_ACCUMULATE([win32_features_h], [	@echo "[#]endif" >>  $(top_srcdir)/src/cairo-features.h])
+	CAIRO_MAKEFILE_ACCUMULATE([win32_features_h], [	@$(call echo,[#]endif) >>  $(top_srcdir)/src/cairo-features.h])
 ])dnl
 CAIRO_MAKEFILE_ACCUMULATE_FEATURE([win32_features_h],yes,*,*,dnl
-[	@echo "[#]define cr_feature_tag 1" >> $(top_srcdir)/src/cairo-features.h]dnl
+[	@$(call echo,[#]define cr_feature_tag 1) >> $(top_srcdir)/src/cairo-features.h]dnl
 )dnl
 
 
diff --git a/src/Makefile.win32 b/src/Makefile.win32
index 864791f37..5c710382a 100644
--- a/src/Makefile.win32
+++ b/src/Makefile.win32
@@ -2,6 +2,11 @@ top_srcdir = ..
 include $(top_srcdir)/build/Makefile.win32.common
 include Makefile.win32.features
 
+define n
+
+
+endef
+
 SOURCES = $(enabled_cairo_sources)
 
 STATIC_SOURCES = cairo-system.c
@@ -19,11 +24,11 @@ $(CFG)/cairo-static.lib: $(OBJECTS_STATIC)
 	@$(AR) $(CAIRO_ARFLAGS) -OUT:$@ $(PIXMAN_LIBS) $(OBJECTS_STATIC)
 
 all: inform $(CFG)/cairo.dll $(CFG)/cairo-static.lib
-	@echo "Built successfully!"
-	@echo "You should copy the following files to a proper place now:"
-	@echo ""
-	@echo "	cairo-version.h (NOTE: toplevel, not the src/cairo-version.h one!)"
-	@echo "	src/cairo-features.h"
-	@for x in $(enabled_cairo_headers); do echo "	src/$$x"; done
-	@echo "	src/$(CFG)/cairo.dll"
-	@echo "	src/$(CFG)/cairo-static.lib"
+	@$(call echo,Built successfully!)
+	@$(call echo,You should copy the following files to a proper place now:)
+	@$(call echo)
+	@$(call echo, cairo-version.h (NOTE: toplevel, not the src/cairo-version.h one!))
+	@$(call echo, src/cairo-features.h)
+	$(foreach x,$(enabled_cairo_headers),@$(call echo, src/$x$n))
+	@$(call echo, src/$(CFG)/cairo.dll)
+	@$(call echo, src/$(CFG)/cairo-static.lib)
-- 
2.20.1



More information about the cairo mailing list