- ensure $MAKE is set

- support $MAKE as gmake for getvars()
This commit is contained in:
mrg 2006-05-12 02:07:59 +00:00
parent 8794aeca0e
commit f9d28bd46c

View File

@ -1,4 +1,4 @@
# $NetBSD: mknative.common,v 1.3 2004/12/11 07:40:50 jmc Exp $ # $NetBSD: mknative.common,v 1.4 2006/05/12 02:07:59 mrg Exp $
# #
# from: NetBSD: mknative,v 1.12 2003/03/05 06:17:17 mrg Exp # from: NetBSD: mknative,v 1.12 2003/03/05 06:17:17 mrg Exp
# #
@ -10,11 +10,30 @@ bomb()
exit 1 exit 1
} }
# Make sure we can run OK.
if [ -x "$MAKE" ]; then
:
else
bomb "MAKE not set"
fi
# usage: getvars MAKEFILE VARNAME [VARNAME...] # usage: getvars MAKEFILE VARNAME [VARNAME...]
# #
getvars() getvars()
{ {
_mf="$1"; shift _mf="$1"; shift
case "$MAKE" in
*gmake)
env MAKEFLAGS= $MAKE -f - -f "$_TMPDIR/$_mf" _x_ <<EOF || bomb "getvars $_mf $* failed"
define echo_var
@echo G_\${var}=\${\${var}} | sed -e 's,\([^\.]\)\./\([a-zA-Z0-9_-]*\.o\),\1\2,g' -e 's,$_VPATH,\$\${GNUHOSTDIST},g'
endef
_x_:
\$(foreach var,$*,\$(echo_var))
EOF
;;
*)
$MAKE -f - _x_ <<EOF || bomb "getvars $_mf $* failed" $MAKE -f - _x_ <<EOF || bomb "getvars $_mf $* failed"
_x_: _x_:
.for var in $* .for var in $*
@ -22,6 +41,8 @@ _x_:
.endfor .endfor
.include "$_TMPDIR/$_mf" .include "$_TMPDIR/$_mf"
EOF EOF
;;
esac
} }
# usage: write_c FILENAME # usage: write_c FILENAME