| @@ -1,611 +1,619 @@ | | | @@ -1,611 +1,619 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # $NetBSD: mknative-gcc,v 1.40 2009/11/30 10:03:57 uebayasi Exp $ | | 2 | # $NetBSD: mknative-gcc,v 1.41 2009/11/30 14:34:17 uebayasi 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 src/gnu/dist/gcc. | | 5 | # platform build of src/gnu/dist/gcc. |
6 | # | | 6 | # |
7 | | | 7 | |
8 | # initialise | | 8 | # initialise |
9 | | | 9 | |
10 | _TMPDIR=$2 | | 10 | _TMPDIR=$2 |
11 | _TOP=$3 | | 11 | _TOP=$3 |
12 | _PLATFORM=$4 | | 12 | _PLATFORM=$4 |
13 | _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` | | 13 | _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` |
14 | _GNU_DIST=`cd ${_VPATH}; pwd` | | 14 | _GNU_DIST=`cd ${_VPATH}; pwd` |
15 | | | 15 | |
16 | . $_TOP/tools/gcc/mknative.common | | 16 | . $_TOP/tools/gcc/mknative.common |
17 | | | 17 | |
18 | ##### gnu/lib/crtstuff ##### | | 18 | ##### gnu/lib/crtstuff ##### |
19 | | | 19 | |
20 | get_crtstuff () { | | 20 | get_crtstuff () { |
21 | _subdir="$1" | | 21 | _subdir="$1" |
22 | mkdir -p $_TOP/gnu/lib/$_subdir/arch | | 22 | mkdir -p $_TOP/gnu/lib/$_subdir/arch |
23 | | | 23 | |
24 | getvars gcc/Makefile \ | | 24 | getvars gcc/Makefile \ |
25 | INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS \ | | 25 | INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS \ |
26 | tm_defines xm_file xm_defines \ | | 26 | tm_defines xm_file xm_defines \ |
27 | | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH.mk | | 27 | | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH.mk |
28 | } | | 28 | } |
29 | | | 29 | |
30 | ##### gnu/lib/libg2c ##### | | 30 | ##### gnu/lib/libg2c ##### |
31 | | | 31 | |
32 | get_libg2c () { | | 32 | get_libg2c () { |
33 | mkdir -p $_TOP/gnu/lib/libg2c3/arch/$MACHINE_ARCH | | 33 | mkdir -p $_TOP/gnu/lib/libg2c3/arch/$MACHINE_ARCH |
34 | | | 34 | |
35 | write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h | | 35 | write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h |
36 | write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h | | 36 | write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h |
37 | | | 37 | |
38 | { | | 38 | { |
39 | getvars $_PLATFORM/libf2c/Makefile \ | | 39 | getvars $_PLATFORM/libf2c/Makefile \ |
40 | F2CEXT | | 40 | F2CEXT |
41 | getvars $_PLATFORM/libf2c/libF77/Makefile \ | | 41 | getvars $_PLATFORM/libf2c/libF77/Makefile \ |
42 | ALL_CFLAGS OBJS | | 42 | ALL_CFLAGS OBJS |
43 | getvars $_PLATFORM/libf2c/libI77/Makefile \ | | 43 | getvars $_PLATFORM/libf2c/libI77/Makefile \ |
44 | ALL_CFLAGS OBJS | sed 's,=,+=,' | | 44 | ALL_CFLAGS OBJS | sed 's,=,+=,' |
45 | getvars $_PLATFORM/libf2c/libU77/Makefile \ | | 45 | getvars $_PLATFORM/libf2c/libU77/Makefile \ |
46 | ALL_CFLAGS OBJS | sed 's,=,+=,' | | 46 | ALL_CFLAGS OBJS | sed 's,=,+=,' |
47 | } | write_mk gnu/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk | | 47 | } | write_mk gnu/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk |
48 | } | | 48 | } |
49 | | | 49 | |
50 | ##### gnu/lib/libgcc ##### | | 50 | ##### gnu/lib/libgcc ##### |
51 | | | 51 | |
52 | get_libgcc_list_funcs_asm () { | | 52 | get_libgcc_list_funcs_asm () { |
53 | getvars gcc/Makefile LIB1ASMFUNCS | { | | 53 | getvars gcc/Makefile LIB1ASMFUNCS | { |
54 | # print newline separated list | | 54 | # print newline separated list |
55 | sed -e ' | | 55 | sed -e ' |
56 | s,^.*=,, | | 56 | s,^.*=,, |
57 | s, *$,, | | 57 | s, *$,, |
58 | s, *, ,g | | 58 | s, *, ,g |
59 | s, ,\ | | 59 | s, ,\ |
60 | ,g' | | 60 | ,g' |
61 | } | { | | 61 | } | { |
62 | # print foo and foo_s | | 62 | # print foo and foo_s |
63 | sed -ne ' | | 63 | sed -ne ' |
64 | /./ { | | 64 | /./ { |
65 | p | | 65 | p |
66 | s,$,_s, | | 66 | s,$,_s, |
67 | p | | 67 | p |
68 | } | | 68 | } |
69 | ' | | 69 | ' |
70 | } | sort | | 70 | } | sort |
71 | } | | 71 | } |
72 | | | 72 | |
73 | get_libgcc_list_funcs_lib () { | | 73 | get_libgcc_list_funcs_lib () { |
74 | local _lib=$1 | | 74 | local _lib=$1 |
75 | local _lib_prefix=${_lib%.*} | | 75 | local _lib_prefix=${_lib%.*} |
76 | local _lib_suffix=${_lib#*.} | | 76 | local _lib_suffix=${_lib#*.} |
77 | | | 77 | |
78 | sed -ne ' | | 78 | sed -ne ' |
79 | /^\.\/'${_lib_prefix}'\.'${_lib_suffix}': .*\.o$/ { | | 79 | /^\.\/'${_lib_prefix}'\.'${_lib_suffix}': .*\.o$/ { |
80 | s,^.*/,, | | 80 | s,^.*/,, |
81 | s,\.o$,, | | 81 | s,\.o$,, |
82 | p | | 82 | p |
83 | } | | 83 | } |
84 | ' build/gcc/libgcc.mk | sort | | 84 | ' build/gcc/libgcc.mk | sort |
85 | } | | 85 | } |
86 | | | 86 | |
87 | get_libgcc_list_objs_libs () { | | 87 | get_libgcc_list_objs_libs () { |
88 | cat build/gcc/libgcc.mk | \ | | 88 | cat build/gcc/libgcc.mk | \ |
89 | egrep '^\.\/(libgcc_s\.so|libgcc\.a|libgcc_eh\.a|libgcov\.a): (libgcc_s|libgcc|libgcc_eh|libgcov)\/.*\.o$' | \ | | 89 | egrep '^\.\/(libgcc_s\.so|libgcc\.a|libgcc_eh\.a|libgcov\.a): (libgcc_s|libgcc|libgcc_eh|libgcov)\/.*\.o$' | \ |
90 | sed -e ' | | 90 | sed -e ' |
91 | s,^\.\/,, | | 91 | s,^\.\/,, |
92 | s,: .*/, , | | 92 | s,: .*/, , |
93 | s,^\(.*\) \(.*\)$,\2 \1, | | 93 | s,^\(.*\) \(.*\)$,\2 \1, |
94 | ' | sort | | 94 | ' | sort |
95 | } | | 95 | } |
96 | | | 96 | |
97 | get_libgcc_list_objs_srcs () { | | 97 | get_libgcc_list_objs_srcs () { |
98 | { | | 98 | if [ -e $_TOP/${libgcc_db_funcs}.S ]; then |
99 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ | | 99 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ |
100 | comm -23 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \ | | 100 | comm -23 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \ |
101 | sed -e 's,\(.*\),\1.o \1.c,' | | 101 | sed -e 's,\(.*\),\1.o \1.c,' |
102 | | | 102 | |
103 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ | | 103 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ |
104 | comm -12 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \ | | 104 | comm -12 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \ |
105 | sed -e 's,\(.*\),\1.o \1.S,' | | 105 | sed -e 's,\(.*\),\1.o \1.S,' |
106 | } | sort | | 106 | else |
| | | 107 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ |
| | | 108 | sed -e 's,\(.*\),\1.o \1.c,' |
| | | 109 | fi | sort |
107 | } | | 110 | } |
108 | | | 111 | |
109 | get_libgcc_list_objs_tmplsrcs () { | | 112 | get_libgcc_list_objs_tmplsrcs () { |
110 | grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \ | | 113 | grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \ |
111 | sed -ne ' | | 114 | sed -ne ' |
112 | s,^.* -c \([^ ]*\).* -o .*/\([^ ]*\.o\)$,\2 \1, | | 115 | s,^.* -c \([^ ]*\).* -o .*/\([^ ]*\.o\)$,\2 \1, |
113 | # basename | | 116 | # basename |
114 | /\$/ { s,\$.*/,,; } | | 117 | /\$/ { s,\$.*/,,; } |
115 | /\// { s,\/.*/,,; } | | 118 | /\// { s,\/.*/,,; } |
116 | p | | 119 | p |
117 | ' | sort | | 120 | ' | sort |
118 | } | | 121 | } |
119 | | | 122 | |
120 | get_libgcc_list_objs_xflags () { | | 123 | get_libgcc_list_objs_xflags () { |
121 | local _flags=$1 | | 124 | local _flags=$1 |
122 | | | 125 | |
123 | grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \ | | 126 | grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \ |
124 | sed -n ' | | 127 | sed -n ' |
125 | x | | 128 | x |
126 | :loop | | 129 | :loop |
127 | g | | 130 | g |
128 | s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\5 \2/p | | 131 | s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\5 \2/p |
129 | g | | 132 | g |
130 | s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\1 \3 \4\/\5/ | | 133 | s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\1 \3 \4\/\5/ |
131 | h | | 134 | h |
132 | t loop | | 135 | t loop |
133 | ' | sort | | 136 | ' | sort |
134 | } | | 137 | } |
135 | | | 138 | |
136 | get_libgcc_list_objs_cppflags () { | | 139 | get_libgcc_list_objs_cppflags () { |
137 | get_libgcc_list_objs_xflags D | | 140 | get_libgcc_list_objs_xflags D |
138 | } | | 141 | } |
139 | | | 142 | |
140 | get_libgcc_list_objs_copts () { | | 143 | get_libgcc_list_objs_copts () { |
141 | get_libgcc_list_objs_xflags fmx | | 144 | get_libgcc_list_objs_xflags fmx |
142 | } | | 145 | } |
143 | | | 146 | |
144 | get_libgcc_list_tmplsrcs () { | | 147 | get_libgcc_list_tmplsrcs () { |
145 | local _lib=$1 | | 148 | local _lib=$1 |
146 | local _tmplallsrcs=$( mktemp /tmp/mknative-gcc._tmplallsrcs.XXXXXX ) | | 149 | local _tmplallsrcs=$( mktemp /tmp/mknative-gcc._tmplallsrcs.XXXXXX ) |
147 | | | 150 | |
148 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} | | 151 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} |
149 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | | 152 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} |
150 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | | 153 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} |
151 | | | 154 | |
152 | # all files | | 155 | # all files |
153 | local _lib_prefix=${_lib%.*} | | 156 | local _lib_prefix=${_lib%.*} |
154 | local _lib_suffix=${_lib#*.} | | 157 | local _lib_suffix=${_lib#*.} |
155 | join $_TOP/$libgcc_db_objs_libs $_TOP/$libgcc_db_objs_tmplsrcs | \ | | 158 | join $_TOP/$libgcc_db_objs_libs $_TOP/$libgcc_db_objs_tmplsrcs | \ |
156 | grep ${_lib_prefix}'\.'${_lib_suffix} | cut -d' ' -f 3 | sort -u > \ | | 159 | grep ${_lib_prefix}'\.'${_lib_suffix} | cut -d' ' -f 3 | sort -u > \ |
157 | $_tmplallsrcs | | 160 | $_tmplallsrcs |
158 | | | 161 | |
159 | # TMPLFPSRCS = [fdp]p-bit.c | | 162 | # TMPLFPSRCS = [fdp]p-bit.c |
160 | grep '[fdt]p-bit\.c' <$_tmplallsrcs | sort -u | \ | | 163 | grep '[fdt]p-bit\.c' <$_tmplallsrcs | sort -u | \ |
161 | writefile ${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | | 164 | writefile ${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} |
162 | | | 165 | |
163 | # TMPLASMSRCS = $(LIB1ASMSRC) | | 166 | # TMPLASMSRCS = $(LIB1ASMSRC) |
164 | grep '\$(LIB1ASMSRC)' <$_tmplallsrcs | sort -u | \ | | 167 | grep '\$(LIB1ASMSRC)' <$_tmplallsrcs | sort -u | \ |
165 | writefile ${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | | 168 | writefile ${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} |
166 | | | 169 | |
167 | # TMPLSRCS is anything else; exclude TMPLFPSRCS and TMPLASMSRCS | | 170 | # TMPLSRCS is anything else; exclude TMPLFPSRCS and TMPLASMSRCS |
168 | cat $_tmplallsrcs | \ | | 171 | cat $_tmplallsrcs | \ |
169 | comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | \ | | 172 | comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | \ |
170 | comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \ | | 173 | comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \ |
171 | writefile ${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} | | 174 | writefile ${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} |
172 | | | 175 | |
173 | rm -f $_tmplallsrcs | | 176 | rm -f $_tmplallsrcs |
174 | } | | 177 | } |
175 | | | 178 | |
176 | get_libgcc_new_analyze () { | | 179 | get_libgcc_new_analyze () { |
177 | mkdir -p $_TOP/${_machine_arch_subdir} | | 180 | mkdir -p $_TOP/${_machine_arch_subdir} |
178 | | | 181 | |
| | | 182 | touch $_TOP/${libgcc_db_funcs}.S |
179 | get_libgcc_list_funcs_asm | \ | | 183 | get_libgcc_list_funcs_asm | \ |
180 | writefile ${libgcc_db_funcs}.S | | 184 | writefile ${libgcc_db_funcs}.S |
181 | | | 185 | |
182 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do | | 186 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do |
| | | 187 | touch $_TOP/${libgcc_db_funcs}.${_lib%.*} |
183 | get_libgcc_list_funcs_lib $_lib | \ | | 188 | get_libgcc_list_funcs_lib $_lib | \ |
184 | writefile ${libgcc_db_funcs}.${_lib%.*} | | 189 | writefile ${libgcc_db_funcs}.${_lib%.*} |
185 | done | | 190 | done |
186 | | | 191 | |
187 | get_libgcc_list_objs_libs | writefile ${libgcc_db_objs_libs} | | 192 | get_libgcc_list_objs_libs | writefile ${libgcc_db_objs_libs} |
188 | get_libgcc_list_objs_srcs | writefile ${libgcc_db_objs_srcs} | | 193 | get_libgcc_list_objs_srcs | writefile ${libgcc_db_objs_srcs} |
189 | get_libgcc_list_objs_tmplsrcs | writefile ${libgcc_db_objs_tmplsrcs} | | 194 | get_libgcc_list_objs_tmplsrcs | writefile ${libgcc_db_objs_tmplsrcs} |
190 | get_libgcc_list_objs_cppflags | writefile ${libgcc_db_objs_cppflags} | | 195 | get_libgcc_list_objs_cppflags | writefile ${libgcc_db_objs_cppflags} |
191 | get_libgcc_list_objs_copts | writefile ${libgcc_db_objs_copts} | | 196 | get_libgcc_list_objs_copts | writefile ${libgcc_db_objs_copts} |
192 | | | 197 | |
193 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do | | 198 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do |
194 | get_libgcc_list_tmplsrcs $_lib | | 199 | get_libgcc_list_tmplsrcs $_lib |
195 | done | | 200 | done |
196 | } | | 201 | } |
197 | | | 202 | |
198 | ##### | | 203 | ##### |
199 | | | 204 | |
200 | get_libgcc_gen_tmplsrcs_tmplsrcs () { | | 205 | get_libgcc_gen_tmplsrcs_tmplsrcs () { |
201 | local _lib=$1 | | 206 | local _lib=$1 |
202 | | | 207 | |
203 | printf '\n' | | 208 | printf '\n' |
204 | printf 'TMPLSRCS.%s = \\\n' $_lib | | 209 | printf 'TMPLSRCS.%s = \\\n' $_lib |
205 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} | | 210 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} |
206 | } | | 211 | } |
207 | | | 212 | |
208 | get_libgcc_gen_tmplsrcs_tmplfpsrcs () { | | 213 | get_libgcc_gen_tmplsrcs_tmplfpsrcs () { |
209 | local _lib=$1 | | 214 | local _lib=$1 |
210 | | | 215 | |
211 | printf '\n' | | 216 | printf '\n' |
212 | printf 'TMPLFPSRCS.%s = \\\n' $_lib | | 217 | printf 'TMPLFPSRCS.%s = \\\n' $_lib |
213 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | | 218 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} |
214 | } | | 219 | } |
215 | | | 220 | |
216 | get_libgcc_gen_tmplsrcs_tmplasmsrcs () { | | 221 | get_libgcc_gen_tmplsrcs_tmplasmsrcs () { |
217 | local _lib=$1 | | 222 | local _lib=$1 |
218 | | | 223 | |
219 | printf '\n' | | 224 | printf '\n' |
220 | printf 'TMPLASMSRCS.%s = \\\n' $_lib | | 225 | printf 'TMPLASMSRCS.%s = \\\n' $_lib |
221 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \ | | 226 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \ |
222 | sed -e 's,LIB1ASMSRC,G_&,' | | 227 | sed -e 's,LIB1ASMSRC,G_&,' |
223 | } | | 228 | } |
224 | | | 229 | |
225 | get_libgcc_gen_srcs () { | | 230 | get_libgcc_gen_srcs () { |
226 | local _lib=$1 | | 231 | local _lib=$1 |
227 | | | 232 | |
228 | printf '\n' | | 233 | printf '\n' |
229 | printf 'SRCS.%s = \\\n' $_lib | | 234 | printf 'SRCS.%s = \\\n' $_lib |
230 | { | | 235 | if [ -e $_TOP/${libgcc_db_funcs}.S ]; then |
231 | comm -23 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \ | | 236 | comm -23 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \ |
232 | sed -e 's,$,.c,; s,^,tmp_,' | | 237 | sed -e 's,$,.c,; s,^,tmp_,' |
233 | comm -12 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \ | | 238 | comm -12 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \ |
234 | sed -e 's,$,.S,; s,^,tmp_,' | | 239 | sed -e 's,$,.S,; s,^,tmp_,' |
235 | } | sort | \ | | 240 | else |
| | | 241 | cat $_TOP/${libgcc_db_funcs}.${_lib%.*} | \ |
| | | 242 | sed -e 's,$,.c,; s,^,tmp_,' |
| | | 243 | fi | sort | \ |
236 | sed -e 's,^, ,; s,$, \\,' | | 244 | sed -e 's,^, ,; s,$, \\,' |
237 | } | | 245 | } |
238 | | | 246 | |
239 | _lookup_objs () { | | 247 | _lookup_objs () { |
240 | local _obj=$1; local _key=$2 | | 248 | local _obj=$1; local _key=$2 |
241 | | | 249 | |
242 | eval grep \^$_obj\\\ \$_TOP/\${libgcc_db_objs_${_key}} | cut -f2 | | 250 | eval grep \^$_obj\\\ \$_TOP/\${libgcc_db_objs_${_key}} | cut -f2 |
243 | } | | 251 | } |
244 | | | 252 | |
245 | get_libgcc_gen_srcs_tmplsrcs () { | | 253 | get_libgcc_gen_srcs_tmplsrcs () { |
246 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ | | 254 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ |
247 | while read _obj; do | | 255 | while read _obj; do |
248 | printf 'SRCS.tmp_%s=%s\n' \ | | 256 | printf 'SRCS.tmp_%s=%s\n' \ |
249 | "$( _lookup_objs $_obj srcs )" \ | | 257 | "$( _lookup_objs $_obj srcs )" \ |
250 | "$( _lookup_objs $_obj tmplsrcs )" | | 258 | "$( _lookup_objs $_obj tmplsrcs )" |
251 | done | \ | | 259 | done | \ |
252 | sed -e 's,\$(\(.*\)),${G_\1},' | | 260 | sed -e 's,\$(\(.*\)),${G_\1},' |
253 | } | | 261 | } |
254 | | | 262 | |
255 | get_libgcc_gen_srcs_cppflags () { | | 263 | get_libgcc_gen_srcs_cppflags () { |
256 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ | | 264 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ |
257 | while read _obj; do | | 265 | while read _obj; do |
258 | printf '_CPPFLAGS.tmp_%s=%s\n' \ | | 266 | printf '_CPPFLAGS.tmp_%s=%s\n' \ |
259 | "$( _lookup_objs $_obj srcs )" \ | | 267 | "$( _lookup_objs $_obj srcs )" \ |
260 | "$( _lookup_objs $_obj cppflags | xargs )" | | 268 | "$( _lookup_objs $_obj cppflags | xargs )" |
261 | done | | 269 | done |
262 | } | | 270 | } |
263 | | | 271 | |
264 | get_libgcc_gen_srcs_copts () { | | 272 | get_libgcc_gen_srcs_copts () { |
265 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ | | 273 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ |
266 | while read _obj; do | | 274 | while read _obj; do |
267 | printf 'COPTS.tmp_%s=%s\n' \ | | 275 | printf 'COPTS.tmp_%s=%s\n' \ |
268 | "$( _lookup_objs $_obj srcs )" \ | | 276 | "$( _lookup_objs $_obj srcs )" \ |
269 | "$( _lookup_objs $_obj copts | xargs )" | | 277 | "$( _lookup_objs $_obj copts | xargs )" |
270 | done | | 278 | done |
271 | } | | 279 | } |
272 | | | 280 | |
273 | get_libgcc_new_generate () { | | 281 | get_libgcc_new_generate () { |
274 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do | | 282 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do |
275 | for _tmpl in tmplsrcs tmplfpsrcs tmplasmsrcs; do | | 283 | for _tmpl in tmplsrcs tmplfpsrcs tmplasmsrcs; do |
276 | eval get_libgcc_gen_tmplsrcs_${_tmpl} $_lib | \ | | 284 | eval get_libgcc_gen_tmplsrcs_${_tmpl} $_lib | \ |
277 | write_mk ${libgcc_libs_mk}.${_lib%.*}.tmplsrcs.${_tmpl}.mk | | 285 | write_mk ${libgcc_libs_mk}.${_lib%.*}.tmplsrcs.${_tmpl}.mk |
278 | done | | 286 | done |
279 | | | 287 | |
280 | get_libgcc_gen_srcs $_lib | \ | | 288 | get_libgcc_gen_srcs $_lib | \ |
281 | write_mk ${libgcc_libs_mk}.${_lib%.*}.srcs.mk | | 289 | write_mk ${libgcc_libs_mk}.${_lib%.*}.srcs.mk |
282 | done | | 290 | done |
283 | | | 291 | |
284 | for _arg in tmplsrcs cppflags copts; do | | 292 | for _arg in tmplsrcs cppflags copts; do |
285 | eval get_libgcc_gen_srcs_${_arg} | \ | | 293 | eval get_libgcc_gen_srcs_${_arg} | \ |
286 | eval writefile \$libgcc_srcs_mk_${_arg} | | 294 | eval writefile \$libgcc_srcs_mk_${_arg} |
287 | done | | 295 | done |
288 | } | | 296 | } |
289 | | | 297 | |
290 | ##### | | 298 | ##### |
291 | | | 299 | |
292 | get_libgcc_new () { | | 300 | get_libgcc_new () { |
293 | _subdir="$1" | | 301 | _subdir="$1" |
294 | | | 302 | |
295 | # List of generated files. | | 303 | # List of generated files. |
296 | | | 304 | |
297 | _machine_arch_subdir=gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH | | 305 | _machine_arch_subdir=gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH |
298 | | | 306 | |
299 | libgcc_db_funcs=${_machine_arch_subdir}/funcs | | 307 | libgcc_db_funcs=${_machine_arch_subdir}/funcs |
300 | libgcc_db_tmplsrcs=${_machine_arch_subdir}/tmplsrcs | | 308 | libgcc_db_tmplsrcs=${_machine_arch_subdir}/tmplsrcs |
301 | libgcc_db_objs_libs=${_machine_arch_subdir}/objs.libs | | 309 | libgcc_db_objs_libs=${_machine_arch_subdir}/objs.libs |
302 | libgcc_db_objs_srcs=${_machine_arch_subdir}/objs.srcs | | 310 | libgcc_db_objs_srcs=${_machine_arch_subdir}/objs.srcs |
303 | libgcc_db_objs_tmplsrcs=${_machine_arch_subdir}/objs.tmplsrcs | | 311 | libgcc_db_objs_tmplsrcs=${_machine_arch_subdir}/objs.tmplsrcs |
304 | libgcc_db_objs_cppflags=${_machine_arch_subdir}/objs.cppflags | | 312 | libgcc_db_objs_cppflags=${_machine_arch_subdir}/objs.cppflags |
305 | libgcc_db_objs_copts=${_machine_arch_subdir}/objs.copts | | 313 | libgcc_db_objs_copts=${_machine_arch_subdir}/objs.copts |
306 | | | 314 | |
307 | get_libgcc_new_analyze | | 315 | get_libgcc_new_analyze |
308 | | | 316 | |
309 | libgcc_libs_mk=${_machine_arch_subdir}/libs | | 317 | libgcc_libs_mk=${_machine_arch_subdir}/libs |
310 | libgcc_srcs_mk=${_machine_arch_subdir}/srcs.mk | | 318 | libgcc_srcs_mk=${_machine_arch_subdir}/srcs.mk |
311 | libgcc_srcs_mk_tmplsrcs=${_machine_arch_subdir}/srcs.tmplsrcs.mk | | 319 | libgcc_srcs_mk_tmplsrcs=${_machine_arch_subdir}/srcs.tmplsrcs.mk |
312 | libgcc_srcs_mk_cppflags=${_machine_arch_subdir}/srcs.cppflags.mk | | 320 | libgcc_srcs_mk_cppflags=${_machine_arch_subdir}/srcs.cppflags.mk |
313 | libgcc_srcs_mk_copts=${_machine_arch_subdir}/srcs.copts.mk | | 321 | libgcc_srcs_mk_copts=${_machine_arch_subdir}/srcs.copts.mk |
314 | | | 322 | |
315 | get_libgcc_new_generate | | 323 | get_libgcc_new_generate |
316 | } | | 324 | } |
317 | | | 325 | |
318 | get_libgcc () { | | 326 | get_libgcc () { |
319 | _subdir="$1" | | 327 | _subdir="$1" |
320 | mkdir -p $_TOP/gnu/lib/lib$_subdir/arch | | 328 | mkdir -p $_TOP/gnu/lib/lib$_subdir/arch |
321 | | | 329 | |
322 | case "$_subdir" in | | 330 | case "$_subdir" in |
323 | gcc3) | | 331 | gcc3) |
324 | _extravars="USE_COLLECT2 LIB2FUNCS_1 LIB2FUNCS_2 xm_file" | | 332 | _extravars="USE_COLLECT2 LIB2FUNCS_1 LIB2FUNCS_2 xm_file" |
325 | _archsubdir="" | | 333 | _archsubdir="" |
326 | ;; | | 334 | ;; |
327 | gcc4) | | 335 | gcc4) |
328 | _extravars="COLLECT2 UNWIND_H xm_include_list" | | 336 | _extravars="COLLECT2 UNWIND_H xm_include_list" |
329 | _archsubdir="" | | 337 | _archsubdir="" |
330 | ;; | | 338 | ;; |
331 | esac | | 339 | esac |
332 | | | 340 | |
333 | # DPBIT, FPBIT only used on mn10[23]00, we don't need them. | | 341 | # DPBIT, FPBIT only used on mn10[23]00, we don't need them. |
334 | # XXX we should probably grab everything Just In Case for | | 342 | # XXX we should probably grab everything Just In Case for |
335 | # the future. | | 343 | # the future. |
336 | { | | 344 | { |
337 | getvars gcc/Makefile \ | | 345 | getvars gcc/Makefile \ |
338 | INCLUDES LIB2ADD LIB2ADDEH \ | | 346 | INCLUDES LIB2ADD LIB2ADDEH \ |
339 | LIB1ASMFUNCS LIB1ASMSRC \ | | 347 | LIB1ASMFUNCS LIB1ASMSRC \ |
340 | LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \ | | 348 | LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \ |
341 | LIBGCC2_CFLAGS \ | | 349 | LIBGCC2_CFLAGS \ |
342 | SHLIB_MKMAP SHLIB_MKMAP_OPTS \ | | 350 | SHLIB_MKMAP SHLIB_MKMAP_OPTS \ |
343 | SHLIB_MAPFILES SHLIB_NM_FLAGS \ | | 351 | SHLIB_MAPFILES SHLIB_NM_FLAGS \ |
344 | EXTRA_HEADERS xm_defines \ | | 352 | EXTRA_HEADERS xm_defines \ |
345 | tm_defines ${_extravars} | | 353 | tm_defines ${_extravars} |
346 | } | write_mk gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk | | 354 | } | write_mk gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk |
347 | | | 355 | |
348 | # Generate new style files. | | 356 | # Generate new style files. |
349 | if [ -n "${MKNATIVE_LIBGCC_NEW}" ]; then | | 357 | if [ -n "${MKNATIVE_LIBGCC_NEW}" ]; then |
350 | get_libgcc_new $_subdir | | 358 | get_libgcc_new $_subdir |
351 | fi | | 359 | fi |
352 | } | | 360 | } |
353 | | | 361 | |
354 | ##### gnu/lib/libgcov ##### | | 362 | ##### gnu/lib/libgcov ##### |
355 | | | 363 | |
356 | get_libgcov () { | | 364 | get_libgcov () { |
357 | _subdir="$1" | | 365 | _subdir="$1" |
358 | | | 366 | |
359 | mkdir -p $_TOP/gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH | | 367 | mkdir -p $_TOP/gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH |
360 | | | 368 | |
361 | { | | 369 | { |
362 | getvars gcc/Makefile \ | | 370 | getvars gcc/Makefile \ |
363 | LIBGCOV | | 371 | LIBGCOV |
364 | } | write_mk gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk | | 372 | } | write_mk gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk |
365 | | | 373 | |
366 | write_c gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ | | 374 | write_c gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ |
367 | <$_TMPDIR/gcc/gcov-iov.h | | 375 | <$_TMPDIR/gcc/gcov-iov.h |
368 | | | 376 | |
369 | } | | 377 | } |
370 | | | 378 | |
371 | ##### gnu/usr.bin/gcc[34]/libiberty ##### | | 379 | ##### gnu/usr.bin/gcc[34]/libiberty ##### |
372 | | | 380 | |
373 | get_gcc_libiberty () { | | 381 | get_gcc_libiberty () { |
374 | _subdir="$1" | | 382 | _subdir="$1" |
375 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH | | 383 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH |
376 | | | 384 | |
377 | getvars libiberty/Makefile \ | | 385 | getvars libiberty/Makefile \ |
378 | ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ | | 386 | ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ |
379 | | write_mk gnu/usr.bin/$_subdir/libiberty/defs.mk | | 387 | | write_mk gnu/usr.bin/$_subdir/libiberty/defs.mk |
380 | | | 388 | |
381 | write_c gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH/config.h \ | | 389 | write_c gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH/config.h \ |
382 | <$_TMPDIR/libiberty/config.h | | 390 | <$_TMPDIR/libiberty/config.h |
383 | } | | 391 | } |
384 | | | 392 | |
385 | ##### gnu/lib/libobjc ##### | | 393 | ##### gnu/lib/libobjc ##### |
386 | | | 394 | |
387 | get_libobjc () { | | 395 | get_libobjc () { |
388 | case "$1" in | | 396 | case "$1" in |
389 | *4) | | 397 | *4) |
390 | _subdir="$1/arch/$MACHINE_ARCH" | | 398 | _subdir="$1/arch/$MACHINE_ARCH" |
391 | _options="ALL_OPT_FILES" | | 399 | _options="ALL_OPT_FILES" |
392 | _unwind="UNWIND_H" | | 400 | _unwind="UNWIND_H" |
393 | ;; | | 401 | ;; |
394 | *) | | 402 | *) |
395 | _subdir="$1" | | 403 | _subdir="$1" |
396 | _options="" | | 404 | _options="" |
397 | _unwind="" | | 405 | _unwind="" |
398 | ;; | | 406 | ;; |
399 | esac | | 407 | esac |
400 | | | 408 | |
401 | mkdir -p $_TOP/gnu/lib/$_subdir | | 409 | mkdir -p $_TOP/gnu/lib/$_subdir |
402 | | | 410 | |
403 | { | | 411 | { |
404 | if [ -n "$_options" ]; then | | 412 | if [ -n "$_options" ]; then |
405 | getvars gcc/Makefile $_options | | 413 | getvars gcc/Makefile $_options |
406 | fi | | 414 | fi |
407 | getvars $_PLATFORM/libobjc/Makefile \ | | 415 | getvars $_PLATFORM/libobjc/Makefile \ |
408 | ALL_CFLAGS INCLUDES OBJS OBJC_H \ | | 416 | ALL_CFLAGS INCLUDES OBJS OBJC_H \ |
409 | | sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" | | 417 | | sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" |
410 | if [ -n "$_unwind" ]; then | | 418 | if [ -n "$_unwind" ]; then |
411 | getvars gcc/Makefile $_unwind | | 419 | getvars gcc/Makefile $_unwind |
412 | fi | | 420 | fi |
413 | } | write_mk gnu/lib/$_subdir/defs.mk | | 421 | } | write_mk gnu/lib/$_subdir/defs.mk |
414 | | | 422 | |
415 | write_c gnu/lib/$_subdir/config.h \ | | 423 | write_c gnu/lib/$_subdir/config.h \ |
416 | <$_TMPDIR/$_PLATFORM/libobjc/config.h | | 424 | <$_TMPDIR/$_PLATFORM/libobjc/config.h |
417 | } | | 425 | } |
418 | | | 426 | |
419 | ##### gnu/lib/libstdc++-v3 ##### | | 427 | ##### gnu/lib/libstdc++-v3 ##### |
420 | | | 428 | |
421 | get_libstdcxx_v3 () { | | 429 | get_libstdcxx_v3 () { |
422 | _subdir="$1" | | 430 | _subdir="$1" |
423 | mkdir -p $_TOP/gnu/lib/$_subdir/arch/$MACHINE_ARCH | | 431 | mkdir -p $_TOP/gnu/lib/$_subdir/arch/$MACHINE_ARCH |
424 | | | 432 | |
425 | case ${_subdir} in | | 433 | case ${_subdir} in |
426 | *4) | | 434 | *4) |
427 | _src_CC_files="atomicity_file CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC CLOCALE_CC BASIC_FILE_CC" | | 435 | _src_CC_files="atomicity_file CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC CLOCALE_CC BASIC_FILE_CC" |
428 | _headers1="host_headers debug_headers tr1_headers c_compatibility_headers_extra" | | 436 | _headers1="host_headers debug_headers tr1_headers c_compatibility_headers_extra" |
429 | _headers2="thread_host_headers host_headers_extra" | | 437 | _headers2="thread_host_headers host_headers_extra" |
430 | _build_headers="c++allocator.h c++config.h cxxabi_tweaks.h gthr-default.h gthr-posix.h gthr-single.h gthr-tpf.h gthr.h" | | 438 | _build_headers="c++allocator.h c++config.h cxxabi_tweaks.h gthr-default.h gthr-posix.h gthr-single.h gthr-tpf.h gthr.h" |
431 | _unwind="UNWIND_H" | | 439 | _unwind="UNWIND_H" |
432 | ;; | | 440 | ;; |
433 | *) | | 441 | *) |
434 | _src_CC_files="" | | 442 | _src_CC_files="" |
435 | _headers1="target_headers" | | 443 | _headers1="target_headers" |
436 | _headers2="thread_target_headers target_headers_extra" | | 444 | _headers2="thread_target_headers target_headers_extra" |
437 | _build_headers="c++config.h gthr-default.h gthr-posix.h gthr-single.h gthr.h" | | 445 | _build_headers="c++config.h gthr-default.h gthr-posix.h gthr-single.h gthr.h" |
438 | _unwind="" | | 446 | _unwind="" |
439 | ;; | | 447 | ;; |
440 | esac | | 448 | esac |
441 | | | 449 | |
442 | # build files | | 450 | # build files |
443 | for h in $_build_headers; do | | 451 | for h in $_build_headers; do |
444 | write_c gnu/lib/$_subdir/arch/$MACHINE_ARCH/$h \ | | 452 | write_c gnu/lib/$_subdir/arch/$MACHINE_ARCH/$h \ |
445 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h | | 453 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h |
446 | done | | 454 | done |
447 | | | 455 | |
448 | write_c gnu/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ | | 456 | write_c gnu/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ |
449 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h | | 457 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h |
450 | | | 458 | |
451 | { | | 459 | { |
452 | # libmath | | 460 | # libmath |
453 | getvars $_PLATFORM/libstdc++-v3/libmath/Makefile \ | | 461 | getvars $_PLATFORM/libstdc++-v3/libmath/Makefile \ |
454 | libmath_la_SOURCES libmath_la_LIBADD | | 462 | libmath_la_SOURCES libmath_la_LIBADD |
455 | | | 463 | |
456 | # libsupc++ | | 464 | # libsupc++ |
457 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ | | 465 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ |
458 | sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/' | | 466 | sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/' |
459 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ | | 467 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ |
460 | c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/' | | 468 | c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/' |
461 | | | 469 | |
462 | # src | | 470 | # src |
463 | getvars $_PLATFORM/libstdc++-v3/src/Makefile \ | | 471 | getvars $_PLATFORM/libstdc++-v3/src/Makefile \ |
464 | sources $_src_CC_files SECTION_FLAGS | sed 's/^G_sources=/G_SRC_SOURCES=/' | | 472 | sources $_src_CC_files SECTION_FLAGS | sed 's/^G_sources=/G_SRC_SOURCES=/' |
465 | | | 473 | |
466 | # include | | 474 | # include |
467 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 475 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
468 | c_base_headers_rename std_headers_rename | | 476 | c_base_headers_rename std_headers_rename |
469 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 477 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
470 | bits_headers backward_headers ext_headers c_base_headers_extra \ | | 478 | bits_headers backward_headers ext_headers c_base_headers_extra \ |
471 | $_headers1 | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' | | 479 | $_headers1 | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' |
472 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 480 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
473 | $_headers2 | sed -e 's#\./[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' | | 481 | $_headers2 | sed -e 's#\./[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' |
474 | | | 482 | |
475 | if [ -n "$_unwind" ]; then | | 483 | if [ -n "$_unwind" ]; then |
476 | getvars gcc/Makefile $_unwind | | 484 | getvars gcc/Makefile $_unwind |
477 | fi | | 485 | fi |
478 | } | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk | | 486 | } | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk |
479 | } | | 487 | } |
480 | | | 488 | |
481 | ##### gnu/usr.bin/gcc3 ##### | | 489 | ##### gnu/usr.bin/gcc3 ##### |
482 | | | 490 | |
483 | get_gcc () { | | 491 | get_gcc () { |
484 | _subdir="$1" | | 492 | _subdir="$1" |
485 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH | | 493 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH |
486 | case ${_subdir} in | | 494 | case ${_subdir} in |
487 | gcc4) | | 495 | gcc4) |
488 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH | | 496 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH |
489 | _buildname="BUILD_" | | 497 | _buildname="BUILD_" |
490 | _libcppsubdir="" | | 498 | _libcppsubdir="" |
491 | _extravars="TM_H ALL_OPT_FILES" | | 499 | _extravars="TM_H ALL_OPT_FILES" |
492 | _hconfig_h="" | | 500 | _hconfig_h="" |
493 | _extravars2="tm_file_list build_xm_include_list" | | 501 | _extravars2="tm_file_list build_xm_include_list" |
494 | _extravars3="tm_p_include_list" | | 502 | _extravars3="tm_p_include_list" |
495 | | | 503 | |
496 | ;; | | 504 | ;; |
497 | *) | | 505 | *) |
498 | _buildname="HOST_" | | 506 | _buildname="HOST_" |
499 | _libcppsubdir="gcc/" | | 507 | _libcppsubdir="gcc/" |
500 | _extravars="" | | 508 | _extravars="" |
501 | _hconfig_h="HCONFIG_H" | | 509 | _hconfig_h="HCONFIG_H" |
502 | _extravars2="" | | 510 | _extravars2="" |
503 | _extravars3="" | | 511 | _extravars3="" |
504 | ;; | | 512 | ;; |
505 | esac | | 513 | esac |
506 | | | 514 | |
507 | { | | 515 | { |
508 | getvars gcc/Makefile \ | | 516 | getvars gcc/Makefile \ |
509 | ${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \ | | 517 | ${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \ |
510 | ${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY | \ | | 518 | ${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY | \ |
511 | sed -e 's#build/errors.o#build-errors.o#g' \ | | 519 | sed -e 's#build/errors.o#build-errors.o#g' \ |
512 | -e 's#build/print-rtl.o#build-print-rtl.o#g' \ | | 520 | -e 's#build/print-rtl.o#build-print-rtl.o#g' \ |
513 | -e 's#build/rtl.o#build-rtl.o#g' \ | | 521 | -e 's#build/rtl.o#build-rtl.o#g' \ |
514 | -e 's#build/varray.o#build-varray.o#g' \ | | 522 | -e 's#build/varray.o#build-varray.o#g' \ |
515 | -e 's#build/ggc-none.o#build-ggc-none.o#g' \ | | 523 | -e 's#build/ggc-none.o#build-ggc-none.o#g' \ |
516 | -e 's#build/##g' | | 524 | -e 's#build/##g' |
517 | getvars gcc/Makefile \ | | 525 | getvars gcc/Makefile \ |
518 | ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \ | | 526 | ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \ |
519 | GCOV_OBJS PROTO_OBJS ${_extravars1} \ | | 527 | GCOV_OBJS PROTO_OBJS ${_extravars1} \ |
520 | INCLUDES md_file OBJC_OBJS OBJS out_file version \ | | 528 | INCLUDES md_file OBJC_OBJS OBJS out_file version \ |
521 | BUILD_PREFIX RTL_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \ | | 529 | BUILD_PREFIX RTL_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \ |
522 | GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \ | | 530 | GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \ |
523 | GTFILES GTFILES_LANG_DIR_NAMES \ | | 531 | GTFILES GTFILES_LANG_DIR_NAMES \ |
524 | tm_defines host_xm_file host_xm_defines tm_p_file \ | | 532 | tm_defines host_xm_file host_xm_defines tm_p_file \ |
525 | target_cpu_default ${_extravars} ${_extravars2} \ | | 533 | target_cpu_default ${_extravars} ${_extravars2} \ |
526 | lang_specs_files ${_extravars3} | | 534 | lang_specs_files ${_extravars3} |
527 | getvars gcc/Makefile \ | | 535 | getvars gcc/Makefile \ |
528 | LIB2ADDEHDEP | sed 's/unwind.inc//' | | 536 | LIB2ADDEHDEP | sed 's/unwind.inc//' |
529 | getvars gcc/Makefile \ | | 537 | getvars gcc/Makefile \ |
530 | CXX_OBJS CXX_C_OBJS | sed 's/cp\///g' | | 538 | CXX_OBJS CXX_C_OBJS | sed 's/cp\///g' |
531 | getvars gcc/Makefile \ | | 539 | getvars gcc/Makefile \ |
532 | F77_OBJS | sed 's/f\///g' | | 540 | F77_OBJS | sed 's/f\///g' |
533 | case ${_subdir} in | | 541 | case ${_subdir} in |
534 | gcc4) | | 542 | gcc4) |
535 | getvars libcpp/Makefile \ | | 543 | getvars libcpp/Makefile \ |
536 | libcpp_a_OBJS | | 544 | libcpp_a_OBJS |
537 | ;; | | 545 | ;; |
538 | gcc3) | | 546 | gcc3) |
539 | getvars gcc/Makefile \ | | 547 | getvars gcc/Makefile \ |
540 | LIBCPP_OBJS LIBCPP_H | | 548 | LIBCPP_OBJS LIBCPP_H |
541 | ;; | | 549 | ;; |
542 | esac | | 550 | esac |
543 | getvars gcc/Makefile \ | | 551 | getvars gcc/Makefile \ |
544 | ENABLE_SHARED | | 552 | ENABLE_SHARED |
545 | case ${_subdir} in | | 553 | case ${_subdir} in |
546 | gcc4) | | 554 | gcc4) |
547 | echo G_SHLIB_LINK="$CC -shared" | | 555 | echo G_SHLIB_LINK="$CC -shared" |
548 | echo G_SHLIB_MULTILIB=. | | 556 | echo G_SHLIB_MULTILIB=. |
549 | ;; | | 557 | ;; |
550 | gcc3) | | 558 | gcc3) |
551 | getvars gcc/Makefile \ | | 559 | getvars gcc/Makefile \ |
552 | SHLIB_LINK SHLIB_MULTILIB | | 560 | SHLIB_LINK SHLIB_MULTILIB |
553 | ;; | | 561 | ;; |
554 | esac | | 562 | esac |
555 | } | write_mk gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk | | 563 | } | write_mk gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk |
556 | | | 564 | |
557 | case "$_subdir" in | | 565 | case "$_subdir" in |
558 | gcc3) | | 566 | gcc3) |
559 | hfiles='auto-host configargs cs-hconfig gencheck hconfig gthr-default' | | 567 | hfiles='auto-host configargs cs-hconfig gencheck hconfig gthr-default' |
560 | ;; | | 568 | ;; |
561 | gcc4) | | 569 | gcc4) |
562 | write_c gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h | | 570 | write_c gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h |
563 | hfiles='auto-host configargs gencheck gthr-default tm bconfig config multilib' | | 571 | hfiles='auto-host configargs gencheck gthr-default tm bconfig config multilib' |
564 | ;; | | 572 | ;; |
565 | esac | | 573 | esac |
566 | for f in $hfiles; do | | 574 | for f in $hfiles; do |
567 | write_c gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h | | 575 | write_c gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h |
568 | done | | 576 | done |
569 | } | | 577 | } |
570 | | | 578 | |
571 | ##### main ##### | | 579 | ##### main ##### |
572 | | | 580 | |
573 | case "$1" in | | 581 | case "$1" in |
574 | # .mk and .h files for libgcc bootstrap (from host build) | | 582 | # .mk and .h files for libgcc bootstrap (from host build) |
575 | libgcc) | | 583 | libgcc) |
576 | get_libgcc gcc3 | | 584 | get_libgcc gcc3 |
577 | get_crtstuff crtstuff3 | | 585 | get_crtstuff crtstuff3 |
578 | exit 0 | | 586 | exit 0 |
579 | ;; | | 587 | ;; |
580 | | | 588 | |
581 | libgcc4) | | 589 | libgcc4) |
582 | get_libgcc gcc4 | | 590 | get_libgcc gcc4 |
583 | get_crtstuff crtstuff4 | | 591 | get_crtstuff crtstuff4 |
584 | exit 0 | | 592 | exit 0 |
585 | ;; | | 593 | ;; |
586 | | | 594 | |
587 | # gcc files | | 595 | # gcc files |
588 | gcc4) | | 596 | gcc4) |
589 | get_gcc gcc4 | | 597 | get_gcc gcc4 |
590 | get_libgcc gcc4 | | 598 | get_libgcc gcc4 |
591 | get_libgcov gcc4 | | 599 | get_libgcov gcc4 |
592 | get_crtstuff crtstuff4 | | 600 | get_crtstuff crtstuff4 |
593 | get_gcc_libiberty gcc4 | | 601 | get_gcc_libiberty gcc4 |
594 | get_libobjc libobjc4 | | 602 | get_libobjc libobjc4 |
595 | get_libstdcxx_v3 libstdc++-v3_4 | | 603 | get_libstdcxx_v3 libstdc++-v3_4 |
596 | exit 0 | | 604 | exit 0 |
597 | ;; | | 605 | ;; |
598 | | | 606 | |
599 | gcc3) | | 607 | gcc3) |
600 | get_gcc gcc3 | | 608 | get_gcc gcc3 |
601 | get_libg2c | | 609 | get_libg2c |
602 | get_libgcc gcc3 | | 610 | get_libgcc gcc3 |
603 | get_crtstuff crtstuff3 | | 611 | get_crtstuff crtstuff3 |
604 | get_gcc_libiberty gcc3 | | 612 | get_gcc_libiberty gcc3 |
605 | get_libobjc libobjc3 | | 613 | get_libobjc libobjc3 |
606 | get_libstdcxx_v3 libstdc++-v3 | | 614 | get_libstdcxx_v3 libstdc++-v3 |
607 | exit 0 | | 615 | exit 0 |
608 | ;; | | 616 | ;; |
609 | | | 617 | |
610 | *) echo invalid arguments; exit 1;; | | 618 | *) echo invalid arguments; exit 1;; |
611 | esac | | 619 | esac |