git: 5513d7dee5dd - main - etcupdate: Add a -m flag to change the make binary that's run

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Tue, 09 Aug 2022 21:59:04 UTC
The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=5513d7dee5ddddb1ace63f2df3117c011fc4d50b

commit 5513d7dee5ddddb1ace63f2df3117c011fc4d50b
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2022-08-09 21:56:19 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2022-08-09 21:56:19 +0000

    etcupdate: Add a -m flag to change the make binary that's run
    
    This will allow release/Makefile to forward on ${MAKE} to allow building
    on non-FreeBSD systems where ${MAKE} is something other than make, as
    make is typically GNU make in such situations.
    
    Reviewed by:    jhb, pauamma
    Obtained from:  CheriBSD
    Differential Revision:  https://reviews.freebsd.org/D35854
---
 usr.sbin/etcupdate/etcupdate.8  | 21 ++++++++++++++++++++-
 usr.sbin/etcupdate/etcupdate.sh | 17 ++++++++++++-----
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/usr.sbin/etcupdate/etcupdate.8 b/usr.sbin/etcupdate/etcupdate.8
index 3d48e218494c..be107f6a214d 100644
--- a/usr.sbin/etcupdate/etcupdate.8
+++ b/usr.sbin/etcupdate/etcupdate.8
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 20, 2021
+.Dd August 9, 2022
 .Dt ETCUPDATE 8
 .Os
 .Sh NAME
@@ -41,6 +41,7 @@
 .Op Fl I Ar patterns
 .Op Fl L Ar logfile
 .Op Fl M Ar options
+.Op Fl m Ar make
 .Nm
 .Cm build
 .Op Fl B
@@ -48,6 +49,7 @@
 .Op Fl s Ar source
 .Op Fl L Ar logfile
 .Op Fl M Ar options
+.Op Fl m Ar make
 .Ar tarball
 .Nm
 .Cm diff
@@ -63,6 +65,7 @@
 .Op Fl D Ar destdir
 .Op Fl L Ar logfile
 .Op Fl M Ar options
+.Op Fl m Ar make
 .Nm
 .Cm resolve
 .Op Fl p
@@ -489,6 +492,14 @@ This can be used for to set the
 or
 .Dv TARGET_ARCH
 variables for a cross-build.
+.It Fl m Ar make
+Use
+.Ar make
+as the
+.Xr make 1
+binary when building a
+.Dq current
+tree.
 .It Fl n
 Enable
 .Dq dry-run
@@ -593,6 +604,14 @@ option.
 Specify an alternate path for the log file similar to the
 .Fl L
 option.
+.It Ev MAKE_CMD
+Specify the
+.Xr make 1
+binary when building a
+.Dq current
+tree similar to the
+.Fl m
+option.
 .It Ev MAKE_OPTIONS
 Pass additional options to
 .Xr make 1
diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh
index 1da8fbf140d9..91417801063d 100755
--- a/usr.sbin/etcupdate/etcupdate.sh
+++ b/usr.sbin/etcupdate/etcupdate.sh
@@ -64,12 +64,12 @@ usage()
 	cat <<EOF
 usage: etcupdate [-npBF] [-d workdir] [-r | -s source | -t tarball]
                  [-A patterns] [-D destdir] [-I patterns] [-L logfile]
-                 [-M options]
+                 [-M options] [-m make]
        etcupdate build [-B] [-d workdir] [-s source] [-L logfile] [-M options]
-                 <tarball>
+                 [-m make] <tarball>
        etcupdate diff [-d workdir] [-D destdir] [-I patterns] [-L logfile]
        etcupdate extract [-B] [-d workdir] [-s source | -t tarball]
-                 [-D destdir] [-L logfile] [-M options]
+                 [-D destdir] [-L logfile] [-M options] [-m make]
        etcupdate resolve [-p] [-d workdir] [-D destdir] [-L logfile]
        etcupdate revert [-d workdir] [-D destdir] [-L logfile] file ...
        etcupdate status [-d workdir] [-D destdir]
@@ -186,7 +186,7 @@ build_tree()
 (
 	local destdir dir file make
 
-	make="make $MAKE_OPTIONS -DNO_FILEMON"
+	make="$MAKE_CMD $MAKE_OPTIONS -DNO_FILEMON"
 
 	log "Building tree at $1 with $make"
 
@@ -1707,6 +1707,9 @@ ALWAYS_INSTALL=
 # Files to ignore and never update during a merge.
 IGNORE_FILES=
 
+# The path to the make binary
+MAKE_CMD=make
+
 # Flags to pass to 'make' when building a tree.
 MAKE_OPTIONS=
 
@@ -1719,6 +1722,7 @@ MAKE_OPTIONS=
 # - FREEBSD_ID
 # - IGNORE_FILES
 # - LOGFILE
+# - MAKE_CMD
 # - MAKE_OPTIONS
 # - SRCDIR
 # - WORKDIR
@@ -1734,11 +1738,14 @@ dryrun=
 ignore=
 nobuild=
 preworld=
-while getopts "d:nprs:t:A:BD:FI:L:M:" option; do
+while getopts "d:m:nprs:t:A:BD:FI:L:M:" option; do
 	case "$option" in
 		d)
 			WORKDIR=$OPTARG
 			;;
+		m)
+			MAKE_CMD=$OPTARG
+			;;
 		n)
 			dryrun=YES
 			;;