diff mbox series

[v2,3/4] configure: Prefer gmake on darwin

Message ID 20200825202755.50626-4-r.bolshakov@yadro.com
State New
Headers show
Series Compatibility make fixes for meson | expand

Commit Message

Roman Bolshakov Aug. 25, 2020, 8:27 p.m. UTC
New meson/make build requires GNU make 3.82+ but macOS ships 3.81 even
on Big Sur while homebrew provides GNU make 4.3 as 'gmake' in $PATH.

With the change, 'make' switches over to gmake implicitly.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 configure | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
diff mbox series

Patch

diff --git a/configure b/configure
index 07732bf011..664084992b 100755
--- a/configure
+++ b/configure
@@ -907,6 +907,7 @@  Darwin)
   darwin="yes"
   hax="yes"
   hvf="yes"
+  make="${MAKE-gmake}"
   LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
   if [ "$cpu" = "x86_64" ] ; then
     QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
@@ -920,6 +921,31 @@  Darwin)
   # won't work when we're compiling with gcc as a C compiler.
   QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
   HOST_VARIANT_DIR="darwin"
+  cat > GNUmakefile <<'EOF'
+# This file is auto-generated by configure to implicitly switch from a 'make'
+# invocation to 'gmake'
+
+OLD_MAKE := $(MAKE)
+
+ifeq ($(wildcard config-host.mak),)
+$(error Incomplete configuration. Please run `configure`)
+endif
+include config-host.mak
+
+ifeq ($(MAKECMDGOALS),)
+recurse: all
+endif
+
+.NOTPARALLEL: %
+%: force
+	@echo 'Switch from $(OLD_MAKE) to $(MAKE)'
+	@$(MAKE) -f Makefile $(MAKECMDGOALS)
+force: ;
+.PHONY: force
+GNUmakefile: ;
+config-host.mak: ;
+
+EOF
 ;;
 SunOS)
   solaris="yes"