In shell scripts invoked during a build, and in crunchgen, use ${AWK}

instead of plain "awk".  The Makefiles that invoke these scripts
or programs will pass AWK=${HOST_AWK:Q}.
This commit is contained in:
apb 2008-10-19 22:10:04 +00:00
parent f3f295c281
commit cd5c0f944d
9 changed files with 41 additions and 26 deletions

View File

@ -1,5 +1,7 @@
#!/bin/sh
# $NetBSD: emacs-gen.sh,v 1.2 1997/01/12 19:11:46 tls Exp $
# $NetBSD: emacs-gen.sh,v 1.3 2008/10/19 22:10:04 apb Exp $
: ${AWK:=awk}
case $# in
1) file=$1;;
@ -24,7 +26,7 @@ E_O_F
# Pass 1: print out lines before @START-FUNC-TAB@
# and generate defines and function declarations,
sed -e '1,/@START-FUNC-TAB@/d' -e '/@END-FUNC-TAB@/,$d' < $file |
awk 'BEGIN { nfunc = 0; }
${AWK} 'BEGIN { nfunc = 0; }
/^[ ]*#/ {
print $0;
next;

View File

@ -1,5 +1,7 @@
#!/bin/sh
: ${AWK:=awk}
verbose=no
if [ X"$1" = X-v ] ; then
@ -32,7 +34,7 @@ fi
#
[ $verbose = yes ] && echo "$0: Generating $which man page (0=sh,1=ksh)..." 1>&2
awk 'BEGIN { ksh = '$which'; pr = 1 }
${AWK} 'BEGIN { ksh = '$which'; pr = 1 }
/^\.sh\(/ { pr = ksh - 1; next }
/^\.sh\)/ { pr = 1; next }
/^\.ksh\(/ { pr = ksh; next }

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $NetBSD: siglist.sh,v 1.6 2006/11/14 20:27:10 christos Exp $
# $NetBSD: siglist.sh,v 1.7 2008/10/19 22:10:04 apb Exp $
#
# Script to generate a sorted, complete list of signals, suitable
# for inclusion in trap.c as array initializer.
@ -7,6 +7,8 @@
set -e
: ${AWK:=awk}
in=tmpi$$.c
out=tmpo$$.c
ecode=1
@ -23,9 +25,9 @@ CPP="${1-cc -E}"
{ QwErTy .signal = SIG\1 , .name = "\1", .mess = "\2" },\
#endif/') > $in
$CPP $in > $out
sed -n 's/{ QwErTy/{/p' < $out | awk '{print NR, $0}' | sort -k5n -k1n |
sed -n 's/{ QwErTy/{/p' < $out | ${AWK} '{print NR, $0}' | sort -k5n -k1n |
sed 's/^[0-9]* //' |
awk 'BEGIN { last=0; nsigs=0; }
${AWK} 'BEGIN { last=0; nsigs=0; }
{
if ($4 ~ /^[0-9][0-9]*$/ && $5 == ",") {
n = $4;

View File

@ -1,5 +1,5 @@
#!/bin/sh -
# $NetBSD: mktokens,v 1.10 2003/08/22 11:22:23 agc Exp $
# $NetBSD: mktokens,v 1.11 2008/10/19 22:10:04 apb Exp $
#
# Copyright (c) 1991, 1993
# The Regents of the University of California. All rights reserved.
@ -33,6 +33,8 @@
#
# @(#)mktokens 8.1 (Berkeley) 5/31/93
: ${AWK:=awk}
# The following is a list of tokens. The second column is nonzero if the
# token marks the end of a list. The third column is the name to print in
# error messages.
@ -69,11 +71,11 @@ TNOT 0 "!"
!
nl=`wc -l /tmp/ka$$`
exec > token.h
awk '{print "#define " $1 " " NR-1}' /tmp/ka$$
${AWK} '{print "#define " $1 " " NR-1}' /tmp/ka$$
echo '
/* Array indicating which tokens mark the end of a list */
const char tokendlist[] = {'
awk '{print "\t" $2 ","}' /tmp/ka$$
${AWK} '{print "\t" $2 ","}' /tmp/ka$$
echo '};
const char *const tokname[] = {'
@ -82,7 +84,7 @@ sed -e 's/"/\\"/g' \
/tmp/ka$$
echo '};
'
sed 's/"//g' /tmp/ka$$ | awk '
sed 's/"//g' /tmp/ka$$ | ${AWK} '
/TIF/{print "#define KWDOFFSET " NR-1; print "";
print "const char *const parsekwd[] = {"}
/TIF/,/neverfound/{print " \"" $3 "\","}'

View File

@ -1,4 +1,4 @@
/* $NetBSD: crunchgen.c,v 1.73 2006/10/18 21:20:44 freza Exp $ */
/* $NetBSD: crunchgen.c,v 1.74 2008/10/19 22:10:05 apb Exp $ */
/*
* Copyright (c) 1994 University of Maryland
* All Rights Reserved.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: crunchgen.c,v 1.73 2006/10/18 21:20:44 freza Exp $");
__RCSID("$NetBSD: crunchgen.c,v 1.74 2008/10/19 22:10:05 apb Exp $");
#endif
#include <stdlib.h>
@ -924,6 +924,7 @@ top_makefile_rules(FILE *outmk)
#ifdef NEW_TOOLCHAIN
fprintf(outmk, "OBJCOPY?=objcopy\n");
fprintf(outmk, "NM?=nm\n");
fprintf(outmk, "AWK?=awk\n");
#else
fprintf(outmk, "CRUNCHIDE?=crunchide\n");
#endif
@ -1027,7 +1028,7 @@ prog_makefile_rules(FILE *outmk, prog_t *p)
fprintf(outmk, "\t${LD} -r -o %s/%s.ro $(%s_OBJPATHS)\n",
p->ident, p->name, p->ident);
/* Use one awk command.... */
fprintf(outmk, "\t${NM} -ng %s/%s.ro | awk '/^ *U / { next };",
fprintf(outmk, "\t${NM} -ng %s/%s.ro | ${AWK} '/^ *U / { next };",
p->ident, p->name);
fprintf(outmk, " /^[0-9a-fA-F]+ C/ { next };");
for (lst = p->keepsymbols; lst != NULL; lst = lst->next)

View File

@ -1,5 +1,5 @@
#!/bin/sh -
# $NetBSD: genassym.sh,v 1.3 2008/02/27 22:38:57 matt Exp $
# $NetBSD: genassym.sh,v 1.4 2008/10/19 22:10:05 apb Exp $
#
# Copyright (c) 1997 Matthias Pfaller.
# All rights reserved.
@ -31,7 +31,7 @@
#
progname=${0}
awk=${AWK:-awk}
: ${AWK:=awk}
ccode=0 # generate temporary C file, compile it, execute result
fcode=0 # generate Forth code
@ -85,7 +85,7 @@ if ! mkdir $genassym_temp; then
fi
trap "rm -rf $genassym_temp" 0 1 2 3 15
$awk '
$AWK '
BEGIN {
printf("#define offsetof(type, member) ((size_t)(&((type *)0)->member))\n");
defining = 0;

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $NetBSD: mkioctls,v 1.36 2008/03/23 18:53:51 christos Exp $
# $NetBSD: mkioctls,v 1.37 2008/10/19 22:10:05 apb Exp $
#
# Copyright (c) 1994
# The Regents of the University of California. All rights reserved.
@ -34,6 +34,10 @@
#
# @(#)mkioctls 8.2 (Berkeley) 4/28/95
#
: ${CC:=cc}
: ${AWK:=awk}
echo "/* Automatically generated file, do not edit! */"
#echo "#define const" # XXX: timepps lossage
echo "#define COMPAT_43"
@ -71,13 +75,14 @@ echo "#include <netiso/iso.h>"
echo "#include <dev/ic/hd44780reg.h>"
echo "#include <dev/pci/mlyreg.h>"
echo "#include <prop/proplib.h>"
for i
do
echo "#include <$i>"
done | sed -e "s,${DESTDIR}/usr/include/,,g"
${CC:-cc} -E -nostdinc -idirafter ${DESTDIR}/usr/include -dM ${1+"$@"} | \
${AWK:-awk} '
${CC} -E -nostdinc -idirafter ${DESTDIR}/usr/include -dM ${1+"$@"} | \
${AWK} '
BEGIN {
keep["SLIOCGUNIT"] = 1; # Same as PPPIOCGASYNCMAP
keep["TUNSLMODE"] = 1; # Same as PPPIOCGASYNCMAP

View File

@ -1,5 +1,5 @@
#!/bin/sh -
# $NetBSD: mksiginfos,v 1.4 2008/09/12 20:44:40 christos Exp $
# $NetBSD: mksiginfos,v 1.5 2008/10/19 22:10:05 apb Exp $
#
# Copyright (c) 2003 The NetBSD Foundation, Inc.
# All rights reserved.
@ -29,9 +29,9 @@
# POSSIBILITY OF SUCH DAMAGE.
# allow AWK to be overriden
awk=${AWK:-awk}
: ${AWK:=awk}
$awk '
$AWK '
BEGIN {
print "/* Automatically generated file; do not edit */";
print "#include <stdio.h>";

View File

@ -1,6 +1,6 @@
#! /bin/sh
#
# $NetBSD: makeerrnos.sh,v 1.4 2005/07/17 09:45:50 he Exp $
# $NetBSD: makeerrnos.sh,v 1.5 2008/10/19 22:10:05 apb Exp $
if [ $# -ne 3 ]; then
echo "usage: makeerrnos.sh errno.h signal.h output"
@ -12,6 +12,7 @@ SIGNALH=$2
CFILE=$3.c
HFILE=$3.h
: ${AWK:=awk}
: ${CPP:=cpp}
: ${CPPFLAGS:=}
@ -21,7 +22,7 @@ cat <<__EOF__ > $CFILE
struct systab errnos[] = {
__EOF__
cat ${ERRNOH} | ${CPP} ${CPPFLAGS} -dM |
awk '
${AWK} '
/^#[ ]*define[ ]*E[A-Z0-9]*[ ]*[0-9-][0-9]*[ ]*.*/ {
for (i = 1; i <= NF; i++)
if ($i ~ /define/)
@ -37,7 +38,7 @@ END {
' | sort -n +2 >> $CFILE
echo " { 0L, 0},
};" >> $CFILE
lines=`wc -l $CFILE|awk ' { print $1; } ' -`
lines=`wc -l $CFILE | ${AWK} ' { print $1; } ' -`
lines=`expr $lines - 4`
cat <<__EOF__ >> $CFILE
@ -45,7 +46,7 @@ cat <<__EOF__ >> $CFILE
struct systab signals[] = {
__EOF__
cat ${SIGNALH} | ${CPP} ${CPPFLAGS} -dM |
awk '
${AWK} '
/^#[ ]*define[ ]*S[A-Z0-9]*[ ]*[0-9-][0-9]*[ ]*.*/ {
for (i = 1; i <= NF; i++)
if ($i ~ /define/)