Wed Nov 29 03:06:47 2017 UTC ()
backslash me harder!


(christos)
diff -r1.13 -r1.14 src/tools/gcc/mknative.common

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

--- src/tools/gcc/mknative.common 2017/11/29 02:10:15 1.13
+++ src/tools/gcc/mknative.common 2017/11/29 03:06:46 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: mknative.common,v 1.13 2017/11/29 02:10:15 christos Exp $ 1# $NetBSD: mknative.common,v 1.14 2017/11/29 03:06:46 christos 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
@@ -18,27 +18,27 @@ else @@ -18,27 +18,27 @@ else
18fi 18fi
19 19
20# usage: getvars MAKEFILE VARNAME [VARNAME...] 20# usage: getvars MAKEFILE VARNAME [VARNAME...]
21# 21#
22getvars() 22getvars()
23{ 23{
24 _mfp="$1"; shift 24 _mfp="$1"; shift
25 case "$MAKE" in 25 case "$MAKE" in
26 *gmake) 26 *gmake)
27 _dir=$(dirname "$_TMPDIR/$_mfp") 27 _dir=$(dirname "$_TMPDIR/$_mfp")
28 _mf=$(basename "$_TMPDIR/$_mfp") 28 _mf=$(basename "$_TMPDIR/$_mfp")
29 env MAKEFLAGS= $MAKE -C "$_dir" --quiet -f - -f "$_mf" _x_ <<EOF || bomb "getvars $_mf $* failed" 29 env MAKEFLAGS= $MAKE -C "$_dir" --quiet -f - -f "$_mf" _x_ <<EOF || bomb "getvars $_mf $* failed"
30define echo_var 30define echo_var
31 @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' -e 's/"/\\"/g' -e "s/'/"'\\"/g' 31 @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' -e 's/"/\\\\"/g' -e "s/'/"'\\\\"/g'
32 32
33 33
34endef 34endef
35_x_: 35_x_:
36 \$(foreach var,$*,\$(echo_var)) 36 \$(foreach var,$*,\$(echo_var))
37EOF 37EOF
38 ;; 38 ;;
39 *) 39 *)
40 $MAKE -B -f - _x_ <<EOF || bomb "getvars $_mf $* failed" 40 $MAKE -B -f - _x_ <<EOF || bomb "getvars $_mf $* failed"
41_x_: 41_x_:
42.for var in $* 42.for var in $*
43 @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' 43 @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'
44.endfor 44.endfor
@@ -55,39 +55,39 @@ getlinks() @@ -55,39 +55,39 @@ getlinks()
55 _cs="$1"; shift 55 _cs="$1"; shift
56 _dir="$1"; shift 56 _dir="$1"; shift
57 echo -n G_CONFIGLINKS= 57 echo -n G_CONFIGLINKS=
58 grep "^config_links=" $_cs | sed -e 's@config_links="\([^"]*\)"@\1@g' -e "s@\([^:]*\):\([^ ]*\)@\${GNUHOSTDIST}/${_dir}/\2 \1 @g" 58 grep "^config_links=" $_cs | sed -e 's@config_links="\([^"]*\)"@\1@g' -e "s@\([^:]*\):\([^ ]*\)@\${GNUHOSTDIST}/${_dir}/\2 \1 @g"
59} 59}
60 60
61# usage: write_c FILENAME 61# usage: write_c FILENAME
62# 62#
63write_c() 63write_c()
64{ 64{
65 echo '/* This file is automatically generated. DO NOT EDIT! */' >$_TOP/$1.tmp || \ 65 echo '/* This file is automatically generated. DO NOT EDIT! */' >$_TOP/$1.tmp || \
66 bomb "cannot create $1" 66 bomb "cannot create $1"
67 grep '$''NetBSD' $0 | sed 's,[ #$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp 67 grep '$''NetBSD' $0 | sed 's,[ #$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
68 echo '$NetBSD: mknative.common,v 1.13 2017/11/29 02:10:15 christos Exp $' | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp 68 echo '$NetBSD: mknative.common,v 1.14 2017/11/29 03:06:46 christos Exp $' | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
69 echo '' >>$_TOP/$1.tmp 69 echo '' >>$_TOP/$1.tmp
70 writefile $1 70 writefile $1
71} 71}
72 72
73# usage: write_mk FILENAME 73# usage: write_mk FILENAME
74# 74#
75write_mk() 75write_mk()
76{ 76{
77 echo '# This file is automatically generated. DO NOT EDIT!' >$_TOP/$1.tmp || \ 77 echo '# This file is automatically generated. DO NOT EDIT!' >$_TOP/$1.tmp || \
78 bomb "cannot create $1" 78 bomb "cannot create $1"
79 grep '$''NetBSD' $0 | sed 's,[ #$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp 79 grep '$''NetBSD' $0 | sed 's,[ #$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
80 echo '$NetBSD: mknative.common,v 1.13 2017/11/29 02:10:15 christos Exp $' | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp 80 echo '$NetBSD: mknative.common,v 1.14 2017/11/29 03:06:46 christos Exp $' | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
81 echo '#' >>$_TOP/$1.tmp 81 echo '#' >>$_TOP/$1.tmp
82 writefile $1 82 writefile $1
83} 83}
84 84
85writefile() 85writefile()
86{ 86{
87 sed -e 's,netbsd\(elf\)*1[0-9\.]*\(_\)*[A-Z]*,netbsd\1,' \ 87 sed -e 's,netbsd\(elf\)*1[0-9\.]*\(_\)*[A-Z]*,netbsd\1,' \
88 -e 's,^/\* #undef HAVE_MMAP \*/$,#define HAVE_MMAP 1,' \ 88 -e 's,^/\* #undef HAVE_MMAP \*/$,#define HAVE_MMAP 1,' \
89 >>$_TOP/$1.tmp 89 >>$_TOP/$1.tmp
90 90
91 # Compare new file, sans "generated from" comments and RCS Id, 91 # Compare new file, sans "generated from" comments and RCS Id,
92 # to old file. If they match, don't change anything. 92 # to old file. If they match, don't change anything.
93 rm -f $_TMPDIR/.1 $_TMPDIR/.2 93 rm -f $_TMPDIR/.1 $_TMPDIR/.2