bin/mdw-build: Allow overriding the `make' program.
[profile] / bin / mdw-build
index 2af71e3..45ca7f8 100755 (executable)
@@ -83,6 +83,7 @@ default_depends () {
 : ${clean=yes}
 : ${vpath=yes}
 : ${native=yes}
+: ${make=make}
 default_depends sbuild sbuildsrv
 default_depends sign signkey
 default_depends upload uploadpath
@@ -112,6 +113,7 @@ Build options:
   [no]sbuild[=SERVER]
   [no]sign[=KEYID]
   [no]native
+  make=MAKE
 EOF
 }
 
@@ -151,6 +153,7 @@ for opt; do
     sbuild=*)  sbuild=yes sbuildsrv=${opt#*=} ;;
     dput)      maybe_set dput dputtarget ;;
     dput=*)    dput=yes dputtarget=${opt#*=} ;;
+    make=*)    make=${opt#*=} ;;
 
     distcheck | debian | clean | vpath | native)
       eval "$opt=yes"
@@ -302,7 +305,10 @@ case "$checkout" in
     run git clone -sn $srcpath/.git _source
     assign srcpath $releasepath/_source
     cd $srcpath
-    run git checkout -b mdw-build $checkoutrev
+    run git update-ref refs/heads/mdw-build $checkoutrev ""
+    run git symbolic-ref HEAD refs/heads/mdw-build
+    run git read-tree --reset refs/heads/mdw-build
+    run git checkout-index -afu
     assign gitversion "$(git describe --abbrev=4)"
     ;;
 esac
@@ -363,15 +369,15 @@ print-distdir:
        @echo >&3 $(distdir)
 EOF
 assign distdir \
-       $({ make -f find-distdir.mk print-distdir >/dev/null 2>&1; } 3>&1)
+       $({ $make -f find-distdir.mk print-distdir >/dev/null 2>&1; } 3>&1)
 
 ## Get a tarball distribution.
 case "$distcheck" in
   yes)
-    run make $makeopts distcheck
+    run $make $makeopts distcheck
     ;;
   no)
-    run make $makeopts dist
+    run $make $makeopts dist
     ;;
 esac