]> arthur.barton.de Git - bup.git/commitdiff
Redirect to GNU make when possible
authorRob Browning <rlb@defaultvalue.org>
Sat, 27 Mar 2021 22:05:39 +0000 (17:05 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 28 Mar 2021 21:25:18 +0000 (16:25 -0500)
Rename Makefile to GNUmakefile and add a Makefile that for at least
FreeBSD make will redirect the build to GNU make, and don't fail if
make is not GNU make without checking gmake.

Thanks to Greg Troxel for a reminder about the issue.

Signed-off-by: Rob Browning <rlb@defaultvalue.org
Tested-by: Rob Browning <rlb@defaultvalue.org>
GNUmakefile
Makefile [new file with mode: 0644]
config/configure

index 75dd85c3b0ada1850f5ad2266a5b6c100a3d5a44..fd4931b7dd881350ad0df8cab1c251b471b23bb4 100644 (file)
@@ -58,9 +58,8 @@ initial_setup := $(shell dev/update-checkout-info lib/bup/checkout_info.py $(iso
 initial_setup := $(call shout,$(initial_setup),update-checkout-info failed))
 clean_paths += lib/bup/checkout_info.py
 
-config/config.vars: \
-  configure config/configure config/configure.inc \
-  $(wildcard config/*.in)
+# Dependency changes here should be mirrored in Makefile
+config/config.vars: configure config/configure config/configure.inc config/*.in
        MAKE="$(MAKE)" ./configure
 
 # On some platforms, Python.h and readline.h fight over the
@@ -273,7 +272,7 @@ import-docs: Documentation/clean
        $(pf); git archive origin/man | (cd Documentation && tar -xvf -)
 
 clean: Documentation/clean
-       cd config && rm -rf config.var
+       cd config && rm -rf finished bin config.var
        cd config && rm -f \
          ${CONFIGURE_DETRITUS} ${CONFIGURE_FILES} ${GENERATED_FILES}
        rm -rf $(clean_paths) .pytest_cache
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..e7f6ff9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,15 @@
+
+# Redirect to GNU make
+
+.SUFFIXES:
+
+default: config/finished
+       config/bin/make
+
+.DEFAULT:
+       $(MAKE) config/finished
+       config/bin/make $(.TARGETS)
+
+# Dependency changes here should be mirrored in GNUmakefile
+config/finished: configure config/configure config/configure.inc config/*.in
+       MAKE= ./configure
index f37cd904c6cc022cf4bb66c20ee86899f38ee93f..8b9263d3d6d2f13b1aa123619c15a8c1c36e6ad4 100755 (executable)
@@ -38,7 +38,7 @@ TARGET=bup
 . ./configure.inc
 
 # FIXME: real tmpdir
-rm -rf config.var config.var.tmp config.vars
+rm -rf finished config/bin config.var config.var.tmp config.vars
 
 AC_INIT $TARGET
 
@@ -47,17 +47,17 @@ if ! AC_PROG_CC; then
     exit 1
 fi
 
-MAKE="$(bup_find_prog make "$MAKE")"
-if test -z "$MAKE"; then
-    MAKE="$(bup_find_prog gmake "$GMAKE")"
-fi
-
-if test -z "$MAKE"; then
-    AC_FAIL "ERROR: unable to find make"
-fi
+for make_candidate in make gmake; do
+    found_make="$(bup_find_prog "$make_candidate" "$MAKE")"
+    if test "$found_make" \
+            && ("$found_make" --version | grep "GNU Make"); then
+        MAKE="$found_make"
+        break;
+    fi
+done
 
-if ! ($MAKE --version | grep "GNU Make"); then
-    AC_FAIL "ERROR: $MAKE is not GNU Make"
+if ! test "$MAKE"; then
+    AC_FAIL "ERROR: unable to find GNU make as make or gmake"
 fi
 
 MAKE_VERSION=`$MAKE --version | grep "GNU Make" | awk '{print $3}'`
@@ -316,10 +316,8 @@ AC_SUB bup_have_libacl "$bup_have_libacl"
 AC_CC="$orig_ac_cc"
 LIBS="$orig_libs"
 
-
 AC_OUTPUT config.vars
 
-
 set -euo pipefail
 
 # FIXME: real tmpdir
@@ -328,6 +326,12 @@ echo -n "$MAKE" > config.var.tmp/bup-make
 echo -n "$bup_python_config" > config.var.tmp/bup-python-config
 mv config.var.tmp config.var
 
+if test -e bin; then rm -r bin; fi
+mkdir -p bin
+(cd bin && ln -s "$MAKE" make)
+
+touch finished
+
 printf "
 found: python-config (%q)
 found: git (%q, ($("$bup_git" --version))