Tue Nov 28 22:05:57 2017 UTC ()
use make -C path/to -f Makefile instead of make -f path/to/Makefile
so that includes with relative paths work.


(christos)
diff -r1.11 -r1.12 src/tools/gcc/mknative.common

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

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