Sun Oct 20 16:00:20 2013 UTC ()
Make sure gmake is quiet when grabbing variables.


(skrll)
diff -r1.9 -r1.10 src/tools/gcc/mknative.common

cvs diff -r1.9 -r1.10 src/tools/gcc/mknative.common (expand / switch to unified diff)

--- src/tools/gcc/mknative.common 2007/02/05 18:26:01 1.9
+++ src/tools/gcc/mknative.common 2013/10/20 16:00:20 1.10
@@ -1,40 +1,40 @@ @@ -1,40 +1,40 @@
1# $NetBSD: mknative.common,v 1.9 2007/02/05 18:26:01 apb Exp $ 1# $NetBSD: mknative.common,v 1.10 2013/10/20 16:00:20 skrll Exp $
2# 2#
3# from: NetBSD: mknative,v 1.12 2003/03/05 06:17:17 mrg Exp 3# from: NetBSD: mknative,v 1.12 2003/03/05 06:17:17 mrg Exp
4# 4#
5# shell-fragment common to all "mknative" scripts 5# shell-fragment common to all "mknative" scripts
6 6
7bomb() 7bomb()
8{ 8{
9 echo >&2 "ABORT: $*" 9 echo >&2 "ABORT: $*"
10 exit 1 10 exit 1
11} 11}
12 12
13# Make sure we can run OK. 13# Make sure we can run OK.
14if [ -x "$MAKE" ]; then 14if [ -x "$MAKE" ]; then
15 : 15 :
16else 16else
17 bomb "MAKE not set" 17 bomb "MAKE not set"
18fi 18fi
19 19
20# usage: getvars MAKEFILE VARNAME [VARNAME...] 20# usage: getvars MAKEFILE VARNAME [VARNAME...]
21# 21#
22getvars() 22getvars()
23{ 23{
24 _mf="$1"; shift 24 _mf="$1"; shift
25 case "$MAKE" in 25 case "$MAKE" in
26 *gmake) 26 *gmake)
27 env MAKEFLAGS= $MAKE -f - -f "$_TMPDIR/$_mf" _x_ <<EOF || bomb "getvars $_mf $* failed" 27 env MAKEFLAGS= $MAKE --quiet -f - -f "$_TMPDIR/$_mf" _x_ <<EOF || bomb "getvars $_mf $* failed"
28define echo_var 28define echo_var
29 @echo G_\${var}="\${\${var}}" | sed -e 's,\([^\.]\)\./\([a-zA-Z0-9_-]*\.o\),\1\2,g' -e 's,$_VPATH,\$\${GNUHOSTDIST},g' -e 's,$_GNU_DIST,\$\${GNUHOSTDIST},g' 29 @echo G_\${var}="\${\${var}}" | sed -e 's,\([^\.]\)\./\([a-zA-Z0-9_-]*\.o\),\1\2,g' -e 's,$_VPATH,\$\${GNUHOSTDIST},g' -e 's,$_GNU_DIST,\$\${GNUHOSTDIST},g'
30 30
31endef 31endef
32_x_: 32_x_:
33 \$(foreach var,$*,\$(echo_var)) 33 \$(foreach var,$*,\$(echo_var))
34EOF 34EOF
35 ;; 35 ;;
36 *) 36 *)
37 $MAKE -B -f - _x_ <<EOF || bomb "getvars $_mf $* failed" 37 $MAKE -B -f - _x_ <<EOF || bomb "getvars $_mf $* failed"
38_x_: 38_x_:
39.for var in $* 39.for var in $*
40 @echo G_\${var}=\${\${var}:Q} | sed -e 's,\([^\.]\)\./\([a-zA-Z0-9_-]*\.o\),\1\2,g' -e 's,$_VPATH,\$\${GNUHOSTDIST},g' -e 's,$_GNU_DIST,\$\${GNUHOSTDIST},g' 40 @echo G_\${var}=\${\${var}:Q} | sed -e 's,\([^\.]\)\./\([a-zA-Z0-9_-]*\.o\),\1\2,g' -e 's,$_VPATH,\$\${GNUHOSTDIST},g' -e 's,$_GNU_DIST,\$\${GNUHOSTDIST},g'
@@ -42,39 +42,39 @@ _x_: @@ -42,39 +42,39 @@ _x_:
42.include "$_TMPDIR/$_mf" 42.include "$_TMPDIR/$_mf"
43EOF 43EOF
44 ;; 44 ;;
45 esac 45 esac
46} 46}
47 47
48# usage: write_c FILENAME 48# usage: write_c FILENAME
49# 49#
50write_c() 50write_c()
51{ 51{
52 echo '/* This file is automatically generated. DO NOT EDIT! */' >$_TOP/$1.tmp || \ 52 echo '/* This file is automatically generated. DO NOT EDIT! */' >$_TOP/$1.tmp || \
53 bomb "cannot create $1" 53 bomb "cannot create $1"
54 grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp 54 grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
55 echo '$NetBSD: mknative.common,v 1.9 2007/02/05 18:26:01 apb Exp $' | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp 55 echo '$NetBSD: mknative.common,v 1.10 2013/10/20 16:00:20 skrll Exp $' | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
56 echo '' >>$_TOP/$1.tmp 56 echo '' >>$_TOP/$1.tmp
57 writefile $1 57 writefile $1
58} 58}
59 59
60# usage: write_mk FILENAME 60# usage: write_mk FILENAME
61# 61#
62write_mk() 62write_mk()
63{ 63{
64 echo '# This file is automatically generated. DO NOT EDIT!' >$_TOP/$1.tmp || \ 64 echo '# This file is automatically generated. DO NOT EDIT!' >$_TOP/$1.tmp || \
65 bomb "cannot create $1" 65 bomb "cannot create $1"
66 grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp 66 grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
67 echo '$NetBSD: mknative.common,v 1.9 2007/02/05 18:26:01 apb Exp $' | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp 67 echo '$NetBSD: mknative.common,v 1.10 2013/10/20 16:00:20 skrll Exp $' | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
68 echo '#' >>$_TOP/$1.tmp 68 echo '#' >>$_TOP/$1.tmp
69 writefile $1 69 writefile $1
70} 70}
71 71
72writefile() 72writefile()
73{ 73{
74 sed -e 's,netbsd\(elf\)*1[0-9\.]*\(_\)*[A-Z]*,netbsd\1,' \ 74 sed -e 's,netbsd\(elf\)*1[0-9\.]*\(_\)*[A-Z]*,netbsd\1,' \
75 -e 's,^/\* #undef HAVE_MMAP \*/$,#define HAVE_MMAP 1,' \ 75 -e 's,^/\* #undef HAVE_MMAP \*/$,#define HAVE_MMAP 1,' \
76 >>$_TOP/$1.tmp 76 >>$_TOP/$1.tmp
77 77
78 # Compare new file, sans "generated from" comments and RCS Id, 78 # Compare new file, sans "generated from" comments and RCS Id,
79 # to old file. If they match, don't change anything. 79 # to old file. If they match, don't change anything.
80 rm -f $_TMPDIR/.1 $_TMPDIR/.2 80 rm -f $_TMPDIR/.1 $_TMPDIR/.2