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.
This commit is contained in:
lukem 2023-07-20 15:13:27 +00:00
parent 8a8613b19b
commit c75b14aa91
1 changed files with 12 additions and 16 deletions

View File

@ -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@