Module Name:    src
Committed By:   lukem
Date:           Thu Jul 20 15:13:27 UTC 2023

Modified Files:
        src/tools/make: buildmake.sh.in

Log Message:
tools/make/buildmake.sh: fix quoting

autoconf 2.69 generates @DEFS@ with definitions with
quoted embedded spaces, so rework how docmd() is invoked
to avoid weird quoting issues.

As part of this, remove all the shell variables containing @var@
and just use @var@ directly.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tools/make/buildmake.sh.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tools/make/buildmake.sh.in
diff -u src/tools/make/buildmake.sh.in:1.16 src/tools/make/buildmake.sh.in:1.17
--- src/tools/make/buildmake.sh.in:1.16	Sun Jul 26 09:17:24 2020
+++ src/tools/make/buildmake.sh.in	Thu Jul 20 15:13:27 2023
@@ -1,5 +1,5 @@
 #! /bin/sh
-#	$NetBSD: buildmake.sh.in,v 1.16 2020/07/26 09:17:24 rillig Exp $
+#	$NetBSD: buildmake.sh.in,v 1.17 2023/07/20 15:13:27 lukem Exp $
 #
 # buildmake.sh.in - Autoconf-processed shell script for building make(1).
 #
@@ -7,30 +7,26 @@
 : ${NETBSDSRCDIR:=@srcdir@/../..}
 MKSRCDIR=${NETBSDSRCDIR}/usr.bin/make
 
-_CC="@CC@"
-
-_CFLAGS="@CPPFLAGS@"
-_CFLAGS="${_CFLAGS} -D_PATH_DEFSYSPATH=\"${NETBSDSRCDIR}/share/mk\""
-_CFLAGS="${_CFLAGS} @DEFS@"
-_CFLAGS="${_CFLAGS} @CFLAGS@"
-
-_LDFLAGS="@LDFLAGS@ @LIBS@"
-
-docmd () {
+docmd()
+{
+	local msg=$1
+	local tgt=$2
+	shift 2
 	case "${MAKEVERBOSE:-2}" in
 	0)
 		;;
 	1)
-		echo "    $1 ${2##*/}" ;;
+		echo "    ${msg} ${tgt##*/}" ;;
 	*)
-		echo "$3" ;;
+		echo "$*" ;;
 	esac
-	$3 || exit 1
+	"$@" || exit 1
 }
 
 for f in $MKSRCDIR/*.c; do
-	docmd "compile " "$f" "${_CC} ${_CFLAGS} -c $f"
+	docmd "compile " "$f" @CC@ @CPPFLAGS@ @DEFS@ @CFLAGS@ \
+		-D_PATH_DEFSYSPATH=\"${NETBSDSRCDIR}/share/mk\" -c "$f"
 done
 
 docmd "   link " "${_TOOL_PREFIX:-nb}make" \
-	"${_CC} -o ${_TOOL_PREFIX:-nb}make *.o ${_LDFLAGS}"
+	@CC@ -o ${_TOOL_PREFIX:-nb}make *.o @LDFLAGS@ @LIBS@

Reply via email to