| @@ -1,437 +1,432 @@ | | | @@ -1,437 +1,432 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # $NetBSD: mknative-gcc,v 1.88 2016/10/05 14:16:12 christos Exp $ | | 2 | # $NetBSD: mknative-gcc,v 1.89 2016/10/05 19:25:49 christos Exp $ |
3 | # | | 3 | # |
4 | # Shell script for generating all the constants needed for a native | | 4 | # Shell script for generating all the constants needed for a native |
5 | # platform build of gcc. | | 5 | # platform build of gcc. |
6 | # | | 6 | # |
7 | # This version is for GCC 5.3 | | 7 | # This version is for GCC 5.3 |
8 | | | 8 | |
9 | # initialise | | 9 | # initialise |
10 | | | 10 | |
11 | _TMPDIR=$2 | | 11 | _TMPDIR=$2 |
12 | _TOP=$3 | | 12 | _TOP=$3 |
13 | _SRC=$4 | | 13 | _SRC=$4 |
14 | _PLATFORM=$5 | | 14 | _PLATFORM=$5 |
15 | _DESTDIR=$6 | | 15 | _DESTDIR=$6 |
16 | _TOOLDIR=$7 | | 16 | _TOOLDIR=$7 |
17 | _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` | | 17 | _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` |
18 | _GNU_DIST=`cd ${_VPATH}; pwd` | | 18 | _GNU_DIST=`cd ${_VPATH}; pwd` |
19 | | | 19 | |
20 | if [ -z "$_DESTDIR" ]; then | | 20 | if [ -z "$_DESTDIR" ]; then |
21 | echo "\$_DESTDIR is empty" 2>&1 | | 21 | echo "\$_DESTDIR is empty" 2>&1 |
22 | exit 1 | | 22 | exit 1 |
23 | fi | | 23 | fi |
24 | | | 24 | |
25 | . $_TOP/tools/gcc/mknative.common | | 25 | . $_TOP/tools/gcc/mknative.common |
26 | | | 26 | |
27 | _OUTDIR="$_TOP/external/gpl3/gcc" | | 27 | _OUTDIR="$_TOP/external/gpl3/gcc" |
28 | _OUTDIRBASE="external/gpl3/gcc" | | 28 | _OUTDIRBASE="external/gpl3/gcc" |
29 | | | 29 | |
30 | sanitise_includes () { | | 30 | sanitise_includes () { |
31 | sed \ | | 31 | sed \ |
32 | -e "s,-I$_DESTDIR/usr/include,,g" \ | | 32 | -e "s,-I$_DESTDIR/usr/include,,g" \ |
33 | -e "s,-I$_SRC/external/lgpl3/mpfr/dist/src,,g" \ | | 33 | -e "s,-I$_SRC/external/lgpl3/mpfr/dist/src,,g" \ |
34 | -e "s,-I$_SRC/external/lgpl3/mpc/dist/src,,g" \ | | 34 | -e "s,-I$_SRC/external/lgpl3/mpc/dist/src,,g" \ |
35 | -e "s,-I$_SRC/external/lgpl3/gmp/lib/libgmp/arch/[a-z_0-9-]*,,g" \ | | 35 | -e "s,-I$_SRC/external/lgpl3/gmp/lib/libgmp/arch/[a-z_0-9-]*,,g" \ |
36 | -e "s,-I$_TOOLDIR/include,,g" \ | | 36 | -e "s,-I$_TOOLDIR/include,,g" \ |
37 | -e "s,-I/usr/include/[^ ]*,," | | 37 | -e "s,-I/usr/include/[^ ]*,," |
38 | } | | 38 | } |
39 | | | 39 | |
40 | ##### lib/libg2c ##### | | 40 | ##### lib/libg2c ##### |
41 | | | 41 | |
42 | get_libg2c () { | | 42 | get_libg2c () { |
43 | mkdir -p $_OUTDIR/lib/libg2c3/arch/$MACHINE_ARCH | | 43 | mkdir -p $_OUTDIR/lib/libg2c3/arch/$MACHINE_ARCH |
44 | | | 44 | |
45 | write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h | | 45 | write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h |
46 | write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h | | 46 | write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h |
47 | | | 47 | |
48 | { | | 48 | { |
49 | getvars $_PLATFORM/libf2c/Makefile \ | | 49 | getvars $_PLATFORM/libf2c/Makefile \ |
50 | F2CEXT | | 50 | F2CEXT |
51 | getvars $_PLATFORM/libf2c/libF77/Makefile \ | | 51 | getvars $_PLATFORM/libf2c/libF77/Makefile \ |
52 | ALL_CFLAGS OBJS | | 52 | ALL_CFLAGS OBJS |
53 | getvars $_PLATFORM/libf2c/libI77/Makefile \ | | 53 | getvars $_PLATFORM/libf2c/libI77/Makefile \ |
54 | ALL_CFLAGS OBJS | sed 's,=,+=,' | | 54 | ALL_CFLAGS OBJS | sed 's,=,+=,' |
55 | getvars $_PLATFORM/libf2c/libU77/Makefile \ | | 55 | getvars $_PLATFORM/libf2c/libU77/Makefile \ |
56 | ALL_CFLAGS OBJS | sed 's,=,+=,' | | 56 | ALL_CFLAGS OBJS | sed 's,=,+=,' |
57 | } | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk | | 57 | } | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk |
58 | } | | 58 | } |
59 | | | 59 | |
60 | ##### lib/libgcc ##### | | 60 | ##### lib/libgcc ##### |
61 | | | 61 | |
62 | skipsoftfloat() { | | | |
63 | sed -e 's@${GNUHOSTDIST}/libgcc/soft-fp/[a-z0-9]*.c@@g' -e 's@ @@g' | | | |
64 | } | | | |
65 | | | | |
66 | get_libgcc () { | | 62 | get_libgcc () { |
67 | _subdir="$1" | | 63 | _subdir="$1" |
68 | mkdir -p $_OUTDIR/lib/lib$_subdir/arch | | 64 | mkdir -p $_OUTDIR/lib/lib$_subdir/arch |
69 | | | 65 | |
70 | # DPBIT, FPBIT only used on mn10[23]00, we don't need them. | | 66 | # DPBIT, FPBIT only used on mn10[23]00, we don't need them. |
71 | # XXX we should probably grab everything Just In Case for | | 67 | # XXX we should probably grab everything Just In Case for |
72 | # the future. | | 68 | # the future. |
73 | | | 69 | |
74 | mkdir -p $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH | | 70 | mkdir -p $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH |
75 | cd $_TMPDIR/$_PLATFORM/libgcc | | 71 | cd $_TMPDIR/$_PLATFORM/libgcc |
76 | { | | 72 | { |
77 | getvars $_PLATFORM/libgcc/Makefile \ | | 73 | getvars $_PLATFORM/libgcc/Makefile \ |
78 | INCLUDES LIB2ADDEH LIB2ADD_ST \ | | 74 | INCLUDES LIB2ADD LIB2ADDEH LIB2ADD_ST \ |
79 | LIB1ASMFUNCS LIB1ASMSRC \ | | 75 | LIB1ASMFUNCS LIB1ASMSRC \ |
80 | LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \ | | 76 | LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \ |
81 | LIB2FUNCS_EXTRA \ | | 77 | LIB2FUNCS_EXTRA \ |
82 | LIBGCC2_CFLAGS \ | | 78 | LIBGCC2_CFLAGS \ |
83 | SHLIB_MKMAP SHLIB_MKMAP_OPTS \ | | 79 | SHLIB_MKMAP SHLIB_MKMAP_OPTS \ |
84 | SHLIB_MAPFILES SHLIB_NM_FLAGS | | 80 | SHLIB_MAPFILES SHLIB_NM_FLAGS |
85 | getvars $_PLATFORM/libgcc/Makefile LIB2ADD | skipsoftfloat | | | |
86 | getvars gcc/Makefile \ | | 81 | getvars gcc/Makefile \ |
87 | NOEXCEPTION_FLAGS EXTRA_HEADERS | | 82 | NOEXCEPTION_FLAGS EXTRA_HEADERS |
88 | getlinks config.status libgcc | | 83 | getlinks config.status libgcc |
89 | } | sanitise_includes \ | | 84 | } | sanitise_includes \ |
90 | | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk | | 85 | | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk |
91 | | | 86 | |
92 | if [ "${MACHINE_ARCH}" = "m68000" ] | | 87 | if [ "${MACHINE_ARCH}" = "m68000" ] |
93 | then | | 88 | then |
94 | ex <<__EOF__ $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk | | 89 | ex <<__EOF__ $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk |
95 | /G_LIBGCC2_CFLAGS/ s/-fPIC// | | 90 | /G_LIBGCC2_CFLAGS/ s/-fPIC// |
96 | wq | | 91 | wq |
97 | __EOF__ | | 92 | __EOF__ |
98 | fi | | 93 | fi |
99 | | | 94 | |
100 | for f in auto-target.h; do | | 95 | for f in auto-target.h; do |
101 | write_c $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/$f \ | | 96 | write_c $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/$f \ |
102 | <$_TMPDIR/$_PLATFORM/libgcc/$f | | 97 | <$_TMPDIR/$_PLATFORM/libgcc/$f |
103 | done | | 98 | done |
104 | } | | 99 | } |
105 | | | 100 | |
106 | ##### lib/libgcov ##### | | 101 | ##### lib/libgcov ##### |
107 | | | 102 | |
108 | get_libgcov () { | | 103 | get_libgcov () { |
109 | _subdir="$1" | | 104 | _subdir="$1" |
110 | _mf="$2" | | 105 | _mf="$2" |
111 | | | 106 | |
112 | mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH | | 107 | mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH |
113 | | | 108 | |
114 | { | | 109 | { |
115 | getvars $_mf \ | | 110 | getvars $_mf \ |
116 | LIBGCOV_MERGE \ | | 111 | LIBGCOV_MERGE \ |
117 | LIBGCOV_PROFILER \ | | 112 | LIBGCOV_PROFILER \ |
118 | LIBGCOV_INTERFACE \ | | 113 | LIBGCOV_INTERFACE \ |
119 | LIBGCOV_DRIVER | | 114 | LIBGCOV_DRIVER |
120 | } | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk | | 115 | } | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk |
121 | | | 116 | |
122 | write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ | | 117 | write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ |
123 | <$_TMPDIR/gcc/gcov-iov.h | | 118 | <$_TMPDIR/gcc/gcov-iov.h |
124 | | | 119 | |
125 | } | | 120 | } |
126 | | | 121 | |
127 | ##### lib/libiberty ##### | | 122 | ##### lib/libiberty ##### |
128 | | | 123 | |
129 | get_gcc_libiberty () { | | 124 | get_gcc_libiberty () { |
130 | _subdir="$1" | | 125 | _subdir="$1" |
131 | _libibertydir="lib/libiberty" | | 126 | _libibertydir="lib/libiberty" |
132 | mkdir -p $_OUTDIR/$_libibertydir/arch/$MACHINE_ARCH | | 127 | mkdir -p $_OUTDIR/$_libibertydir/arch/$MACHINE_ARCH |
133 | | | 128 | |
134 | getvars libiberty/Makefile \ | | 129 | getvars libiberty/Makefile \ |
135 | ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ | | 130 | ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ |
136 | | write_mk $_OUTDIRBASE/$_libibertydir/defs.mk | | 131 | | write_mk $_OUTDIRBASE/$_libibertydir/defs.mk |
137 | | | 132 | |
138 | write_c $_OUTDIRBASE/$_libibertydir/arch/$MACHINE_ARCH/config.h \ | | 133 | write_c $_OUTDIRBASE/$_libibertydir/arch/$MACHINE_ARCH/config.h \ |
139 | <$_TMPDIR/libiberty/config.h | | 134 | <$_TMPDIR/libiberty/config.h |
140 | } | | 135 | } |
141 | | | 136 | |
142 | ##### lib/libdecnumber ##### | | 137 | ##### lib/libdecnumber ##### |
143 | | | 138 | |
144 | get_libdecnumber () { | | 139 | get_libdecnumber () { |
145 | _subdir="$1" | | 140 | _subdir="$1" |
146 | | | 141 | |
147 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH | | 142 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH |
148 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/config.h \ | | 143 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/config.h \ |
149 | <$_TMPDIR/libdecnumber/config.h | | 144 | <$_TMPDIR/libdecnumber/config.h |
150 | } | | 145 | } |
151 | | | 146 | |
152 | ##### lib/libgomp ##### | | 147 | ##### lib/libgomp ##### |
153 | | | 148 | |
154 | get_libgomp () { | | 149 | get_libgomp () { |
155 | _subdir="$1" | | 150 | _subdir="$1" |
156 | | | 151 | |
157 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH | | 152 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH |
158 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ | | 153 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ |
159 | <$_TMPDIR/$_PLATFORM/libgomp/config.h | | 154 | <$_TMPDIR/$_PLATFORM/libgomp/config.h |
160 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp_f.h \ | | 155 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp_f.h \ |
161 | <$_TMPDIR/$_PLATFORM/libgomp/libgomp_f.h | | 156 | <$_TMPDIR/$_PLATFORM/libgomp/libgomp_f.h |
162 | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp.spec \ | | 157 | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp.spec \ |
163 | <$_TMPDIR/$_PLATFORM/libgomp/libgomp.spec | | 158 | <$_TMPDIR/$_PLATFORM/libgomp/libgomp.spec |
164 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/omp.h \ | | 159 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/omp.h \ |
165 | <$_TMPDIR/$_PLATFORM/libgomp/omp.h | | 160 | <$_TMPDIR/$_PLATFORM/libgomp/omp.h |
166 | } | | 161 | } |
167 | | | 162 | |
168 | ##### lib/libbacktrace ##### | | 163 | ##### lib/libbacktrace ##### |
169 | | | 164 | |
170 | get_libbacktrace () { | | 165 | get_libbacktrace () { |
171 | _subdir="$1" | | 166 | _subdir="$1" |
172 | | | 167 | |
173 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH | | 168 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH |
174 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ | | 169 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ |
175 | <$_TMPDIR/$_subdir/config.h | | 170 | <$_TMPDIR/$_subdir/config.h |
176 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/backtrace-supported.h \ | | 171 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/backtrace-supported.h \ |
177 | <$_TMPDIR/$_subdir/backtrace-supported.h | | 172 | <$_TMPDIR/$_subdir/backtrace-supported.h |
178 | } | | 173 | } |
179 | | | 174 | |
180 | ##### lib/libobjc ##### | | 175 | ##### lib/libobjc ##### |
181 | | | 176 | |
182 | get_libobjc () { | | 177 | get_libobjc () { |
183 | _subdir="$1/arch/$MACHINE_ARCH" | | 178 | _subdir="$1/arch/$MACHINE_ARCH" |
184 | _options="ALL_OPT_FILES" | | 179 | _options="ALL_OPT_FILES" |
185 | | | 180 | |
186 | mkdir -p $_OUTDIR/lib/$_subdir | | 181 | mkdir -p $_OUTDIR/lib/$_subdir |
187 | | | 182 | |
188 | { | | 183 | { |
189 | if [ -n "$_options" ]; then | | 184 | if [ -n "$_options" ]; then |
190 | getvars gcc/Makefile $_options | | 185 | getvars gcc/Makefile $_options |
191 | fi | | 186 | fi |
192 | getvars $_PLATFORM/libobjc/Makefile \ | | 187 | getvars $_PLATFORM/libobjc/Makefile \ |
193 | ALL_CFLAGS INCLUDES OBJC_SOURCE_FILES C_SOURCE_FILES OBJC_H \ | | 188 | ALL_CFLAGS INCLUDES OBJC_SOURCE_FILES C_SOURCE_FILES OBJC_H \ |
194 | | sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" | | 189 | | sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" |
195 | getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc | | 190 | getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc |
196 | } | sanitise_includes \ | | 191 | } | sanitise_includes \ |
197 | | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk | | 192 | | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk |
198 | | | 193 | |
199 | write_c $_OUTDIRBASE/lib/$_subdir/config.h \ | | 194 | write_c $_OUTDIRBASE/lib/$_subdir/config.h \ |
200 | <$_TMPDIR/$_PLATFORM/libobjc/config.h | | 195 | <$_TMPDIR/$_PLATFORM/libobjc/config.h |
201 | } | | 196 | } |
202 | | | 197 | |
203 | ##### lib/libstdc++-v3 ##### | | 198 | ##### lib/libstdc++-v3 ##### |
204 | | | 199 | |
205 | get_libstdcxx_v3 () { | | 200 | get_libstdcxx_v3 () { |
206 | _subdir="$1" | | 201 | _subdir="$1" |
207 | _ver="$2" | | 202 | _ver="$2" |
208 | | | 203 | |
209 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH | | 204 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH |
210 | | | 205 | |
211 | _build_headers="c++config.h cxxabi_tweaks.h gthr-posix.h gthr-single.h gthr.h" | | 206 | _build_headers="c++config.h cxxabi_tweaks.h gthr-posix.h gthr-single.h gthr.h" |
212 | _headers1="c_base_headers_extra_install" | | 207 | _headers1="c_base_headers_extra_install" |
213 | _headers1="$_headers1 tr1_headers tr2_headers decimal_headers c_compatibility_headers_install" | | 208 | _headers1="$_headers1 tr1_headers tr2_headers decimal_headers c_compatibility_headers_install" |
214 | _headers1="$_headers1 debug_headers parallel_headers" | | 209 | _headers1="$_headers1 debug_headers parallel_headers" |
215 | _headers2="host_headers thread_host_headers" | | 210 | _headers2="host_headers thread_host_headers" |
216 | _pf_headers="profile_headers profile_impl_headers" | | 211 | _pf_headers="profile_headers profile_impl_headers" |
217 | _pb_headers="pb_headers1 pb_headers2 pb_headers3 pb_headers4 pb_headers5 pb_headers6 pb_headers7" | | 212 | _pb_headers="pb_headers1 pb_headers2 pb_headers3 pb_headers4 pb_headers5 pb_headers6 pb_headers7" |
218 | | | 213 | |
219 | # build files | | 214 | # build files |
220 | for h in $_build_headers; do | | 215 | for h in $_build_headers; do |
221 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/$h \ | | 216 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/$h \ |
222 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h | | 217 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h |
223 | done | | 218 | done |
224 | | | 219 | |
225 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/gstdint.h \ | | 220 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/gstdint.h \ |
226 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h | | 221 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h |
227 | | | 222 | |
228 | { | | 223 | { |
229 | # libsupc++ | | 224 | # libsupc++ |
230 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ | | 225 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ |
231 | sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/' | | 226 | sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/' |
232 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ | | 227 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ |
233 | c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/' | | 228 | c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/' |
234 | | | 229 | |
235 | # includes | | 230 | # includes |
236 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 231 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
237 | c_base_headers std_headers | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' | | 232 | c_base_headers std_headers | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' |
238 | | | 233 | |
239 | # src | | 234 | # src |
240 | getvars $_PLATFORM/libstdc++-v3/src/Makefile \ | | 235 | getvars $_PLATFORM/libstdc++-v3/src/Makefile \ |
241 | libstdc___la_SOURCES | sed 's/^G_libstdc___la_SOURCES=/G_SRC_SOURCES=/' | | 236 | libstdc___la_SOURCES | sed 's/^G_libstdc___la_SOURCES=/G_SRC_SOURCES=/' |
242 | getvars $_PLATFORM/libstdc++-v3/src/c++11/Makefile \ | | 237 | getvars $_PLATFORM/libstdc++-v3/src/c++11/Makefile \ |
243 | libc__11convenience_la_SOURCES | \ | | 238 | libc__11convenience_la_SOURCES | \ |
244 | sed -e 's/^G_libc__11convenience_la_SOURCES=/G_CPP11_SOURCES=/' \ | | 239 | sed -e 's/^G_libc__11convenience_la_SOURCES=/G_CPP11_SOURCES=/' \ |
245 | -e 's/codecvt.cc/c11-codecvt.cc/' | | 240 | -e 's/codecvt.cc/c11-codecvt.cc/' |
246 | getvars $_PLATFORM/libstdc++-v3/src/c++98/Makefile \ | | 241 | getvars $_PLATFORM/libstdc++-v3/src/c++98/Makefile \ |
247 | GLIBCXX_ABI_FLAGS libc__98convenience_la_SOURCES | \ | | 242 | GLIBCXX_ABI_FLAGS libc__98convenience_la_SOURCES | \ |
248 | sed -e 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/' \ | | 243 | sed -e 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/' \ |
249 | -e 's/codecvt.cc/c98-codecvt.cc/' | | 244 | -e 's/codecvt.cc/c98-codecvt.cc/' |
250 | getvars $_PLATFORM/libstdc++-v3/Makefile ATOMICITY_SRCDIR \ | | 245 | getvars $_PLATFORM/libstdc++-v3/Makefile ATOMICITY_SRCDIR \ |
251 | BASIC_FILE_CC CLOCALE_CC CCODECVT_CC CCOLLATE_CC \ | | 246 | BASIC_FILE_CC CLOCALE_CC CCODECVT_CC CCOLLATE_CC \ |
252 | CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC \ | | 247 | CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC \ |
253 | CPU_OPT_BITS_RANDOM | | 248 | CPU_OPT_BITS_RANDOM |
254 | | | 249 | |
255 | # includes | | 250 | # includes |
256 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 251 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
257 | backward_headers c_base_headers_extra $_headers1 $_pb_headers | \ | | 252 | backward_headers c_base_headers_extra $_headers1 $_pb_headers | \ |
258 | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' | | 253 | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' |
259 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 254 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
260 | bits_headers ext_headers $_headers2 | \ | | 255 | bits_headers ext_headers $_headers2 | \ |
261 | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' -e 's#\${GNUHOSTDIST}/libstdc++-v3/config/##g' | | 256 | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' -e 's#\${GNUHOSTDIST}/libstdc++-v3/config/##g' |
262 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 257 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
263 | $_pf_headers | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/profile/##g' | | 258 | $_pf_headers | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/profile/##g' |
264 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 259 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
265 | BASIC_FILE_H ALLOCATOR_H CSTDIO_H CLOCALE_H CMESSAGES_H CTIME_H | | 260 | BASIC_FILE_H ALLOCATOR_H CSTDIO_H CLOCALE_H CMESSAGES_H CTIME_H |
266 | getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc | | 261 | getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc |
267 | } | sanitise_includes \ | | 262 | } | sanitise_includes \ |
268 | | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk | | 263 | | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk |
269 | } | | 264 | } |
270 | | | 265 | |
271 | ##### usr.bin/gcc* ##### | | 266 | ##### usr.bin/gcc* ##### |
272 | | | 267 | |
273 | get_gcc_bootstrap () { | | 268 | get_gcc_bootstrap () { |
274 | _subdir="$1" | | 269 | _subdir="$1" |
275 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH | | 270 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH |
276 | for f in auto-host tm config; do | | 271 | for f in auto-host tm config; do |
277 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h | | 272 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h |
278 | done | | 273 | done |
279 | # XXXGCC5 don't really want to copy insn-modes as we build | | 274 | # XXXGCC5 don't really want to copy insn-modes as we build |
280 | # it but libgcc needs to too early yet | | 275 | # it but libgcc needs to too early yet |
281 | for f in insn-modes; do | | 276 | for f in insn-modes; do |
282 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h | | 277 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h |
283 | done | | 278 | done |
284 | } | | 279 | } |
285 | | | 280 | |
286 | get_gcc () { | | 281 | get_gcc () { |
287 | _subdir="$1" | | 282 | _subdir="$1" |
288 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH | | 283 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH |
289 | mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$MACHINE_ARCH | | 284 | mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$MACHINE_ARCH |
290 | mkdir -p $_OUTDIR/usr.bin/include/arch | | 285 | mkdir -p $_OUTDIR/usr.bin/include/arch |
291 | _buildname="BUILD_" | | 286 | _buildname="BUILD_" |
292 | _libcppsubdir="" | | 287 | _libcppsubdir="" |
293 | _extravars="TM_H ALL_OPT_FILES" | | 288 | _extravars="TM_H ALL_OPT_FILES" |
294 | _hconfig_h="" | | 289 | _hconfig_h="" |
295 | _extravars2="tm_file_list build_xm_include_list" | | 290 | _extravars2="tm_file_list build_xm_include_list" |
296 | _extravars3="tm_p_include_list" | | 291 | _extravars3="tm_p_include_list" |
297 | | | 292 | |
298 | { | | 293 | { |
299 | getvars gcc/Makefile \ | | 294 | getvars gcc/Makefile \ |
300 | ${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \ | | 295 | ${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \ |
301 | ${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY \ | | 296 | ${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY \ |
302 | ${_buildname}MD | \ | | 297 | ${_buildname}MD | \ |
303 | sed -e 's#build/errors.o#build-errors.o#g' \ | | 298 | sed -e 's#build/errors.o#build-errors.o#g' \ |
304 | -e 's#build/print-rtl.o#build-print-rtl.o#g' \ | | 299 | -e 's#build/print-rtl.o#build-print-rtl.o#g' \ |
305 | -e 's#build/rtl.o#build-rtl.o#g' \ | | 300 | -e 's#build/rtl.o#build-rtl.o#g' \ |
306 | -e 's#build/varray.o#build-varray.o#g' \ | | 301 | -e 's#build/varray.o#build-varray.o#g' \ |
307 | -e 's#build/ggc-none.o#build-ggc-none.o#g' \ | | 302 | -e 's#build/ggc-none.o#build-ggc-none.o#g' \ |
308 | -e 's#build/##g' | | 303 | -e 's#build/##g' |
309 | getvars gcc/Makefile \ | | 304 | getvars gcc/Makefile \ |
310 | ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \ | | 305 | ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \ |
311 | GCC_OBJS GCOV_OBJS GXX_OBJS GTM_H PROTO_OBJS ${_extravars1} \ | | 306 | GCC_OBJS GCOV_OBJS GXX_OBJS GTM_H PROTO_OBJS ${_extravars1} \ |
312 | INCLUDES md_file OBJC_OBJS OBJS out_file version \ | | 307 | INCLUDES md_file OBJC_OBJS OBJS out_file version \ |
313 | BUILD_PREFIX RTL_H RTL_BASE_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \ | | 308 | BUILD_PREFIX RTL_H RTL_BASE_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \ |
314 | GGC_H \ | | 309 | GGC_H \ |
315 | GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \ | | 310 | GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \ |
316 | GTFILES GTFILES_LANG_DIR_NAMES NOEXCEPTION_FLAGS \ | | 311 | GTFILES GTFILES_LANG_DIR_NAMES NOEXCEPTION_FLAGS \ |
317 | NATIVE_SYSTEM_HEADER_DIR \ | | 312 | NATIVE_SYSTEM_HEADER_DIR \ |
318 | tm_defines host_xm_file host_xm_defines tm_p_file \ | | 313 | tm_defines host_xm_file host_xm_defines tm_p_file \ |
319 | target_cpu_default ${_extravars} ${_extravars2} \ | | 314 | target_cpu_default ${_extravars} ${_extravars2} \ |
320 | lang_specs_files ${_extravars3} \ | | 315 | lang_specs_files ${_extravars3} \ |
321 | common_out_file \ | | 316 | common_out_file \ |
322 | | sanitise_includes | | 317 | | sanitise_includes |
323 | getvars gcc/Makefile \ | | 318 | getvars gcc/Makefile \ |
324 | LIB2ADDEHDEP | sed 's/unwind.inc//' | | 319 | LIB2ADDEHDEP | sed 's/unwind.inc//' |
325 | getvars gcc/Makefile \ | | 320 | getvars gcc/Makefile \ |
326 | CXX_OBJS CXX_C_OBJS | sed 's/cp\///g' | | 321 | CXX_OBJS CXX_C_OBJS | sed 's/cp\///g' |
327 | getvars gcc/Makefile \ | | 322 | getvars gcc/Makefile \ |
328 | F77_OBJS | sed 's/f\///g' | | 323 | F77_OBJS | sed 's/f\///g' |
329 | getvars libcpp/Makefile \ | | 324 | getvars libcpp/Makefile \ |
330 | libcpp_a_OBJS | | 325 | libcpp_a_OBJS |
331 | getvars gcc/Makefile \ | | 326 | getvars gcc/Makefile \ |
332 | ENABLE_SHARED | | 327 | ENABLE_SHARED |
333 | echo G_SHLIB_LINK="$CC -shared" | | 328 | echo G_SHLIB_LINK="$CC -shared" |
334 | echo G_SHLIB_MULTILIB=. | | 329 | echo G_SHLIB_MULTILIB=. |
335 | } | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk | | 330 | } | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk |
336 | | | 331 | |
337 | getvars gcc/Makefile \ | | 332 | getvars gcc/Makefile \ |
338 | EXTRA_HEADERS \ | | 333 | EXTRA_HEADERS \ |
339 | | write_mk $_OUTDIRBASE/usr.bin/include/arch/$MACHINE_ARCH.mk | | 334 | | write_mk $_OUTDIRBASE/usr.bin/include/arch/$MACHINE_ARCH.mk |
340 | | | 335 | |
341 | write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h | | 336 | write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h |
342 | hfiles='auto-host configargs config bconfig bversion plugin-version multilib tm' | | 337 | hfiles='auto-host configargs config bconfig bversion plugin-version multilib tm' |
343 | for f in $hfiles; do | | 338 | for f in $hfiles; do |
344 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h | | 339 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h |
345 | if [ "${MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] | | 340 | if [ "${MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] |
346 | then | | 341 | then |
347 | ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h | | 342 | ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h |
348 | /configuration_arguments/ s/$// | | 343 | /configuration_arguments/ s/$// |
349 | ya | | 344 | ya |
350 | i | | 345 | i |
351 | #ifdef _SOFT_FLOAT | | 346 | #ifdef _SOFT_FLOAT |
352 | . | | 347 | . |
353 | pu | | 348 | pu |
354 | s/";$/ -with-float=soft";/ | | 349 | s/";$/ -with-float=soft";/ |
355 | a | | 350 | a |
356 | #else | | 351 | #else |
357 | #endif | | 352 | #endif |
358 | . | | 353 | . |
359 | . m +1 | | 354 | . m +1 |
360 | /configure_default_options/ s/{ NULL.*$// | | 355 | /configure_default_options/ s/{ NULL.*$// |
361 | a | | 356 | a |
362 | #ifdef _SOFT_FLOAT | | 357 | #ifdef _SOFT_FLOAT |
363 | { "float", "soft" }, | | 358 | { "float", "soft" }, |
364 | #endif | | 359 | #endif |
365 | { NULL, NULL } | | 360 | { NULL, NULL } |
366 | }; | | 361 | }; |
367 | . | | 362 | . |
368 | wq | | 363 | wq |
369 | __EOF__ | | 364 | __EOF__ |
370 | fi | | 365 | fi |
371 | if [ "${f}" = "configargs" ] | | 366 | if [ "${f}" = "configargs" ] |
372 | then | | 367 | then |
373 | _srcquoted=$(echo "$_SRC" | sed 's/\//\\\//g') | | 368 | _srcquoted=$(echo "$_SRC" | sed 's/\//\\\//g') |
374 | ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h | | 369 | ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h |
375 | /static const char configuration_arguments/ s/$_srcquoted/\/usr\/src/g | | 370 | /static const char configuration_arguments/ s/$_srcquoted/\/usr\/src/g |
376 | wq | | 371 | wq |
377 | __EOF__ | | 372 | __EOF__ |
378 | fi | | 373 | fi |
379 | done | | 374 | done |
380 | | | 375 | |
381 | # keep identical | | 376 | # keep identical |
382 | for f in all-tree.def; do | | 377 | for f in all-tree.def; do |
383 | cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f | | 378 | cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f |
384 | done | | 379 | done |
385 | | | 380 | |
386 | # special transforms | | 381 | # special transforms |
387 | for f in gtyp-input.list; do | | 382 | for f in gtyp-input.list; do |
388 | sed -e 's/^.*external\/gpl3\/gcc\/dist/SRCDIR/' < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f | | 383 | sed -e 's/^.*external\/gpl3\/gcc\/dist/SRCDIR/' < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f |
389 | done | | 384 | done |
390 | | | 385 | |
391 | # special platforms | | 386 | # special platforms |
392 | if [ "${MACHINE_ARCH}" = "sh3el" -o "${MACHINE_ARCH}" = "sh3eb" ]; then | | 387 | if [ "${MACHINE_ARCH}" = "sh3el" -o "${MACHINE_ARCH}" = "sh3eb" ]; then |
393 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h | | 388 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h |
394 | fi | | 389 | fi |
395 | | | 390 | |
396 | if [ "${MACHINE_ARCH}" = "i386" -o "${MACHINE_ARCH}" = "x86_64" ]; then | | 391 | if [ "${MACHINE_ARCH}" = "i386" -o "${MACHINE_ARCH}" = "x86_64" ]; then |
397 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/i386-builtin-types.inc <$_TMPDIR/gcc/i386-builtin-types.inc | | 392 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/i386-builtin-types.inc <$_TMPDIR/gcc/i386-builtin-types.inc |
398 | fi | | 393 | fi |
399 | } | | 394 | } |
400 | | | 395 | |
401 | ##### main ##### | | 396 | ##### main ##### |
402 | | | 397 | |
403 | case "$1" in | | 398 | case "$1" in |
404 | # .mk and .h files for libgcc bootstrap (from host build) | | 399 | # .mk and .h files for libgcc bootstrap (from host build) |
405 | | | 400 | |
406 | libgcc*-bootstrap) | | 401 | libgcc*-bootstrap) |
407 | get_libgcc gcc | | 402 | get_libgcc gcc |
408 | get_libgcov gcc $_PLATFORM/libgcc/Makefile | | 403 | get_libgcov gcc $_PLATFORM/libgcc/Makefile |
409 | get_gcc_bootstrap gcc | | 404 | get_gcc_bootstrap gcc |
410 | exit 0 | | 405 | exit 0 |
411 | ;; | | 406 | ;; |
412 | | | 407 | |
413 | libstdc++-bootstrap) | | 408 | libstdc++-bootstrap) |
414 | get_libstdcxx_v3 libstdc++-v3 gcc | | 409 | get_libstdcxx_v3 libstdc++-v3 gcc |
415 | exit 0 | | 410 | exit 0 |
416 | ;; | | 411 | ;; |
417 | | | 412 | |
418 | gcc*) | | 413 | gcc*) |
419 | get_gcc gcc | | 414 | get_gcc gcc |
420 | get_libgcc gcc | | 415 | get_libgcc gcc |
421 | get_libgcov gcc $_PLATFORM/libgcc/Makefile | | 416 | get_libgcov gcc $_PLATFORM/libgcc/Makefile |
422 | get_gcc_bootstrap gcc | | 417 | get_gcc_bootstrap gcc |
423 | get_gcc_libiberty gcc | | 418 | get_gcc_libiberty gcc |
424 | get_libobjc libobjc | | 419 | get_libobjc libobjc |
425 | get_libstdcxx_v3 libstdc++-v3 gcc | | 420 | get_libstdcxx_v3 libstdc++-v3 gcc |
426 | get_libdecnumber libdecnumber | | 421 | get_libdecnumber libdecnumber |
427 | get_libgomp libgomp | | 422 | get_libgomp libgomp |
428 | get_libbacktrace libbacktrace | | 423 | get_libbacktrace libbacktrace |
429 | exit 0 | | 424 | exit 0 |
430 | ;; | | 425 | ;; |
431 | | | 426 | |
432 | | | 427 | |
433 | *) | | 428 | *) |
434 | echo invalid arguments; | | 429 | echo invalid arguments; |
435 | exit 1 | | 430 | exit 1 |
436 | ;; | | 431 | ;; |
437 | esac | | 432 | esac |