Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tools/make tools/make/buildmake.sh: fix quoting



details:   https://anonhg.NetBSD.org/src/rev/5569fe20a3f9
branches:  trunk
changeset: 378103:5569fe20a3f9
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jul 20 15:13:27 2023 +0000

description:
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.

diffstat:

 tools/make/buildmake.sh.in |  28 ++++++++++++----------------
 1 files changed, 12 insertions(+), 16 deletions(-)

diffs (52 lines):

diff -r 1a6ca6a759c0 -r 5569fe20a3f9 tools/make/buildmake.sh.in
--- a/tools/make/buildmake.sh.in        Thu Jul 20 15:12:36 2023 +0000
+++ b/tools/make/buildmake.sh.in        Thu Jul 20 15:13:27 2023 +0000
@@ -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@



Home | Main Index | Thread Index | Old Index