* config/arm/bpabi.h (SUBTARGET_EXTRA_ASM_SPEC): Change meabi=3 to
[official-gcc.git] / gcc / mklibgcc.in
blobebf0a81edb4608e28367cf255f9165308af151d6
1 #!/bin/sh
2 # Construct makefile for libgcc.
3 # Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
5 # This file is part of GCC.
7 # Arguments, taken from the environment, since there are a lot
8 # of them, and positional args becomes quite ugly.
10 # objext
11 # LIB1ASMFUNCS
12 # LIB2FUNCS_ST
13 # LIBGCOV
14 # LIB2ADD
15 # LIB2ADD_ST
16 # LIB2ADDEH
17 # LIB2ADDEHSTATIC
18 # LIB2ADDEHSHARED
19 # LIB2ADDEHDEP
20 # LIBUNWIND
21 # LIBUNWINDDEP
22 # SHLIBUNWIND_LINK
23 # SHLIBUNWIND_INSTALL
24 # FPBIT
25 # FPBIT_FUNCS
26 # LIB2_DIVMOD_FUNCS
27 # DPBIT
28 # DPBIT_FUNCS
29 # TPBIT
30 # TPBIT_FUNCS
31 # LIBGCC
32 # MULTILIBS
33 # EXTRA_MULTILIB_PARTS
34 # SHLIB_EXT
35 # SHLIB_LINK
36 # SHLIB_MULTILIB
37 # SHLIB_MKMAP
38 # SHLIB_MKMAP_OPTS
39 # SHLIB_MAPFILES
40 # SHLIB_NM_FLAGS
41 # SHLIB_INSTALL
42 # MULTILIB_OSDIRNAMES
44 # Make needs VPATH to be literal.
45 echo 'srcdir = @srcdir@'
46 echo 'VPATH = @srcdir@'
47 echo 'EQ = ='
48 echo
49 echo 'force:'
50 echo
52 # Library members defined in libgcc2.c.
53 lib2funcs='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
54 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi
55 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
56 _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache
57 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3
58 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
59 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
60 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2'
62 # Disable SHLIB_LINK if shared libgcc not enabled.
63 if [ "@enable_shared@" = "no" ]; then
64 SHLIB_LINK=""
67 # Build lines.
69 gcc_compile='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
70 make_compile='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
71 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
72 AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
73 AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
74 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
75 CC="$(CC)" CFLAGS="$(CFLAGS)" \
76 BUILD_PREFIX="$(BUILD_PREFIX)" \
77 BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \
78 LANGUAGES="$(LANGUAGES)"'
80 # Generic dependencies for libgcc
81 libgcc_dep='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'
83 # Dependencies for libgcc2.c
84 libgcc2_c_dep='stmp-dirs $(srcdir)/libgcc2.c gbl-ctors.h'" $libgcc_dep"
86 # Dependencies for libgcov.c
87 libgcov_c_dep='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"
89 # Dependencies for fp-bit.c
90 fpbit_c_dep='stmp-dirs config.status tsystem.h'
93 # Build libgcc1 components.
96 libgcc1_objs=""
98 for name in $LIB1ASMFUNCS; do
99 for ml in $MULTILIBS; do
100 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
101 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
102 out="libgcc/${dir}/${name}${objext}"
104 echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
105 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
106 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
108 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
109 # defined as optimized assembly code in LIB1ASMFUNCS.
110 lib2funcs=`echo $lib2funcs | sed -e 's/^'$name' //' \
111 -e 's/ '$name' / /' \
112 -e 's/ '$name'$//'`
113 LIB2_DIVMOD_FUNCS=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
114 -e 's/ '$name' / /' \
115 -e 's/ '$name'$//'`
116 done
117 libgcc1_objs="$libgcc1_objs ${name}${objext}"
118 done
121 # Build libgcc2 components.
124 libgcc2_objs=""
125 libgcc2_st_objs=""
126 libgcc2_eh_static_objs=""
127 libgcc2_eh_shared_objs=""
129 for name in $lib2funcs; do
130 for ml in $MULTILIBS; do
131 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
132 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
133 out="libgcc/${dir}/${name}${objext}"
135 echo $out: $libgcc2_c_dep
136 echo " $gcc_compile" $flags -DL$name \
137 -c '$(srcdir)/libgcc2.c' -o $out
138 done
139 libgcc2_objs="$libgcc2_objs ${name}${objext}"
140 done
142 for name in $LIB2FUNCS_ST; do
143 for ml in $MULTILIBS; do
144 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
145 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
146 out="libgcc/${dir}/${name}${objext}"
148 echo $out: $libgcc2_c_dep
149 echo " $gcc_compile" $flags -DL$name \
150 -c '$(srcdir)/libgcc2.c' -o $out
151 done
152 libgcc2_st_objs="$libgcc2_st_objs ${name}${objext}"
153 done
155 for name in $LIB2_DIVMOD_FUNCS; do
156 for ml in $MULTILIBS; do
157 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
158 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
159 out="libgcc/${dir}/${name}${objext}"
161 echo $out: $libgcc2_c_dep
162 echo " $gcc_compile" $flags -DL$name \
163 -c '$(srcdir)/libgcc2.c' -fexceptions -fnon-call-exceptions -o $out
164 done
165 libgcc2_objs="$libgcc2_objs ${name}${objext}"
166 done
168 if [ "$FPBIT" ]; then
169 for name in $FPBIT_FUNCS; do
170 for ml in $MULTILIBS; do
171 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
172 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
173 out="libgcc/${dir}/${name}${objext}"
175 echo $out: $FPBIT $fpbit_c_dep
176 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
177 -c $FPBIT -o $out
178 done
179 libgcc2_objs="$libgcc2_objs ${name}${objext}"
180 done
183 if [ "$DPBIT" ]; then
184 for name in $DPBIT_FUNCS; do
185 for ml in $MULTILIBS; do
186 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
187 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
188 out="libgcc/${dir}/${name}${objext}"
190 echo $out: $DPBIT $fpbit_c_dep
191 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
192 -c $DPBIT -o $out
193 done
194 libgcc2_objs="$libgcc2_objs ${name}${objext}"
195 done
198 if [ "$TPBIT" ]; then
199 for name in $TPBIT_FUNCS; do
200 for ml in $MULTILIBS; do
201 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
202 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
203 out="libgcc/${dir}/${name}${objext}"
205 echo $out: $TPBIT $fpbit_c_dep
206 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
207 -c $TPBIT -o $out
208 done
209 libgcc2_objs="$libgcc2_objs ${name}${objext}"
210 done
213 for file in $LIB2ADD; do
214 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
215 oname=`echo $name | sed -e 's,.*/,,'`
217 for ml in $MULTILIBS; do
218 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
219 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
220 out="libgcc/${dir}/${oname}${objext}"
221 if [ ${name}.asm = ${file} ]; then
222 flags="$flags -xassembler-with-cpp"
225 echo $out: stmp-dirs $file $libgcc_dep
226 echo " $gcc_compile" $flags -c $file -o $out
227 done
228 libgcc2_objs="$libgcc2_objs ${oname}${objext}"
229 done
231 for file in $LIB2ADDEH; do
232 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
233 oname=`echo $name | sed -e 's,.*/,,'`
235 for ml in $MULTILIBS; do
236 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
237 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
238 out="libgcc/${dir}/${oname}${objext}"
239 if [ ${name}.asm = ${file} ]; then
240 flags="$flags -xassembler-with-cpp"
243 echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
244 echo " $gcc_compile" $flags -fexceptions -c $file -o $out
245 done
246 if [ -z "$SHLIB_LINK" ]; then
247 libgcc2_objs="$libgcc2_objs ${oname}${objext}"
249 done
251 if [ "$SHLIB_LINK" ]; then
252 # Those should be in libgcc_eh.a.
253 for file in $LIB2ADDEHSTATIC; do
254 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
255 oname=`echo $name | sed -e 's,.*/,,'`
256 libgcc2_eh_static_objs="$libgcc2_eh_static_objs ${oname}${objext}"
257 done
259 # Those should be in libgcc.so.
260 for file in $LIB2ADDEHSHARED; do
261 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
262 oname=`echo $name | sed -e 's,.*/,,'`
263 libgcc2_eh_shared_objs="$libgcc2_eh_shared_objs ${oname}${objext}"
264 done
267 for file in $LIB2ADD_ST; do
268 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
269 oname=`echo $name | sed -e 's,.*/,,'`
271 for ml in $MULTILIBS; do
272 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
273 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
274 out="libgcc/${dir}/${oname}${objext}"
275 if [ ${name}.asm = ${file} ]; then
276 flags="$flags -xassembler-with-cpp"
279 echo $out: stmp-dirs $file $libgcc_dep
280 echo " $gcc_compile" $flags -c $file -o $out
281 done
282 libgcc2_st_objs="$libgcc2_st_objs ${oname}${objext}"
283 done
285 if [ "$LIBUNWIND" ]; then
286 libunwind_static_objs=""
287 libunwind_shared_objs=""
288 for file in $LIBUNWIND; do
289 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
290 oname=`echo $name | sed -e 's,.*/,,'`
292 for ml in $MULTILIBS; do
293 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
294 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
295 out="libgcc/${dir}/${oname}${objext}"
296 if [ ${name}.asm = ${file} ]; then
297 flags="$flags -xassembler-with-cpp"
300 echo $out: stmp-dirs $file $LIBUNWINDDEP
301 echo " $gcc_compile" $flags -fexceptions -c $file -o $out
302 echo ${out}s: stmp-dirs $file $LIBUNWINDDEP
303 echo " $gcc_compile" $flags -fexceptions -DSHARED -c $file -o ${out}s
304 done
305 libunwind_static_objs="$libunwind_static_objs ${oname}${objext}"
306 libunwind_shared_objs="$libunwind_shared_objs ${oname}${objext}s"
307 done
311 # build libgcov components
314 libgcov_objs=""
316 for name in $LIBGCOV; do
317 for ml in $MULTILIBS; do
318 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
319 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
320 out="libgcc/${dir}/${name}${objext}"
322 echo $out: $libgcov_c_dep
323 echo " $gcc_compile" $flags -DL$name \
324 -c '$(srcdir)/libgcov.c' -o $out
325 done
326 libgcov_objs="$libgcov_objs ${name}${objext}"
327 done
329 # SHLIB_MKMAP
330 # SHLIB_MKMAP_OPTS
331 # SHLIB_MAPFILES
332 for ml in $MULTILIBS; do
333 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
334 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
336 libgcc_objs=""
337 libgcc_eh_static_objs=""
338 libgcc_eh_shared_objs=""
339 for o in $libgcc1_objs; do
340 libgcc_objs="$libgcc_objs libgcc/${dir}/$o"
341 done
342 for o in $libgcc2_objs; do
343 libgcc_objs="$libgcc_objs libgcc/${dir}/$o"
344 done
345 for o in $libgcc2_eh_static_objs; do
346 libgcc_eh_static_objs="$libgcc_eh_static_objs libgcc/${dir}/$o"
347 done
348 for o in $libgcc2_eh_shared_objs; do
349 libgcc_eh_shared_objs="$libgcc_eh_shared_objs libgcc/${dir}/$o"
350 done
351 libgcc_sh_objs="$libgcc_objs $libgcc_eh_shared_objs"
352 shlib_deps="$libgcc_sh_objs"
354 libgcc_st_objs=""
355 for o in $libgcc2_st_objs; do
356 libgcc_st_objs="$libgcc_st_objs libgcc/${dir}/$o"
357 done
359 libgcov_a_objs=""
360 for o in $libgcov_objs; do
361 libgcov_a_objs="$libgcov_a_objs libgcc/${dir}/$o"
362 done
364 if [ "$LIBUNWIND" ]; then
365 libunwind_a_objs=""
366 for o in $libunwind_static_objs; do
367 libunwind_a_objs="$libunwind_a_objs libgcc/${dir}/$o"
368 done
369 libunwind_sh_objs=""
370 for o in $libunwind_shared_objs; do
371 libunwind_sh_objs="$libunwind_sh_objs libgcc/${dir}/$o"
372 done
373 shlibunwind_deps="$libunwind_sh_objs"
376 if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
377 mapfile="libgcc/${dir}/libgcc.map"
378 tmpmapfile="libgcc/${dir}/tmp-libgcc.map"
379 # This uses a here document instead of echos because some shells
380 # will convert the \1 in the second sed command to a control-A.
381 # The behavior of here documents is more predictable.
382 cat <<EOF
384 ${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES $libgcc_sh_objs
385 { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS $libgcc_sh_objs; echo %%; \\
386 cat $SHLIB_MAPFILES \\
387 | sed -e '/^[ ]*#/d' \\
388 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
389 | $gcc_compile $flags -E -xassembler-with-cpp -; \\
390 } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
391 mv '$tmpmapfile' \$@
394 shlib_deps="$shlib_deps $mapfile"
396 # Depend on EXTRA_MULTILIB_PARTS, since that's where crtbegin/end
397 # usually are put in a true multilib situation.
398 for f in $EXTRA_MULTILIB_PARTS; do
399 shlib_deps="$shlib_deps $dir/$f"
400 done
402 libgcc_a_objs="$libgcc_objs $libgcc_st_objs"
404 if [ "@libgcc_visibility@" = yes -a "$SHLIB_LINK" ]; then
405 libgcc_a_objs=
406 echo ""
407 echo "libgcc/${dir}/stacknote.s: stmp-dirs"
408 echo ' @( echo | $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) '${flags}' -S -o - -xc - | grep .note.GNU-stack || : ) > $@.tmp'
409 echo ' @mv -f $@.tmp $@'
410 echo ""
411 for o in $libgcc_objs $libgcc_st_objs; do
412 # .oS objects will have all non-local symbol definitions .hidden
413 oS=`echo ${o} | sed s~${objext}'$~.oS~g'`
414 echo "${oS}: stmp-dirs libgcc/${dir}/stacknote.s ${o}"
415 # non-GNU nm emits three fields even for undefined and typeless symbols,
416 # so explicitly omit them
417 echo ' ( $(NM_FOR_TARGET) '${SHLIB_NM_FLAGS} ${o}' | $(AWK) '\''NF == 3 && $$2 !~ /^[UN]$$/ { print "\t.hidden", $$3 }'\''; cat libgcc/${dir}/stacknote.s ) | $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) '${flags}' -r -nostdinc -nostdlib -o $@ '${o}' -xassembler -'
418 libgcc_a_objs="${libgcc_a_objs} ${oS}"
419 done
422 # Each of these .a files depends on stmp-dirs. It would seem that
423 # this dependency is redundant, since each of the object files
424 # itself depends on stmp-dirs. However, it is possible that there
425 # are in fact no object files. In that case, the stmp-dirs
426 # dependency is required; the directory containing the archive must
427 # exist before the archive itself can be created.
428 echo ""
429 echo "${dir}/libgcc.a: stmp-dirs $libgcc_a_objs"
430 echo " -rm -rf ${dir}/libgcc.a"
431 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a $libgcc_a_objs
432 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc.a
434 echo ""
435 echo "${dir}/libgcov.a: stmp-dirs $libgcov_a_objs"
436 echo " -rm -rf ${dir}/libgcov.a"
437 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcov.a $libgcov_a_objs
438 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcov.a
440 if [ "$LIBUNWIND" ]; then
441 echo ""
442 echo "${dir}/libunwind.a: stmp-dirs $libunwind_a_objs"
443 echo " -rm -rf ${dir}/libunwind.a"
444 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libunwind.a $libunwind_a_objs
445 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libunwind.a
446 echo ""
447 echo "${dir}/libgcc.a: ${dir}/libunwind.a"
450 if [ "$SHLIB_LINK" ]; then
452 echo ""
453 echo "${dir}/libgcc_eh.a: stmp-dirs $libgcc_eh_static_objs"
454 echo " -rm -rf ${dir}/libgcc_eh.a"
455 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a $libgcc_eh_static_objs
456 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
458 if [ -z "$SHLIB_MULTILIB" ]; then
459 if [ "$dir" = . ]; then
460 shlib_base_name=libgcc_s
461 shlibunwind_base_name=libunwind
462 else
463 shlib_base_name=libgcc_s_`echo $dir | sed s,/,_,g`
464 shlibunwind_base_name=libunwind_`echo $dir | sed s,/,_,g`
466 shlib_so_name="$shlib_base_name"
467 shlibunwind_so_name="$shlibunwind_base_name"
468 if [ "$LIBUNWIND" ]; then
469 shlib_deps="$shlib_deps ${dir}/${shlibunwind_base_name}${SHLIB_EXT}"
471 shlib_dir=
472 shlib_slibdir_qual=
473 if [ -n "$MULTILIB_OSDIRNAMES" ]; then
474 if [ "$dir" != . ]; then
475 gcc_multilib_dir=`./xgcc -B./ $flags --print-multi-directory`
476 os_multilib_dir=`./xgcc -B./ $flags --print-multi-os-directory`
477 shlib_dir="$dir"/
478 gcc_multilib_sup=`echo $gcc_multilib_dir | sed 's~^[^/]*/~~'`
479 os_multilib_base=`echo $os_multilib_dir | sed -n "s~/${gcc_multilib_sup}\$~~p"`
480 if [ -z "$os_multilib_base" ]; then
481 shlib_so_name=libgcc_s
482 shlibunwind_so_name=libunwind
483 if [ "$os_multilib_dir" != "." ]; then
484 shlib_slibdir_qual="/$os_multilib_dir"
486 else
487 shlib_so_name=libgcc_s_`echo $gcc_multilib_sup | sed s,/,_,g`
488 shlibunwind_so_name=libunwind_`echo $gcc_multilib_sup | sed s,/,_,g`
489 shlib_slibdir_qual="/$os_multilib_base"
493 echo ""
494 echo "${dir}/${shlib_base_name}${SHLIB_EXT}: $shlib_deps"
495 echo " $SHLIB_LINK" \
496 | sed -e "s%@multilib_flags@%$flags%g" \
497 -e "s%@multilib_dir@%$dir%g" \
498 -e "s%@shlib_objs@%$libgcc_sh_objs%g" \
499 -e "s%@shlib_base_name@%$shlib_base_name%g" \
500 -e "s%@shlib_map_file@%$mapfile%g" \
501 -e "s%@shlib_so_name@%$shlib_so_name%g" \
502 -e "s%@shlib_dir@%$shlib_dir%g" \
503 -e "s%@shlib_slibdir_qual@%%g"
504 if [ "$LIBUNWIND" ]; then
505 echo ""
506 echo "${dir}/${shlibunwind_base_name}${SHLIB_EXT}: $shlibunwind_deps"
507 echo " $SHLIBUNWIND_LINK" \
508 | sed -e "s%@multilib_flags@%$flags%g" \
509 -e "s%@multilib_dir@%$dir%g" \
510 -e "s%@shlib_objs@%$libunwind_sh_objs%g" \
511 -e "s%@shlib_base_name@%$shlibunwind_base_name%g" \
512 -e "s%@shlib_so_name@%$shlibunwind_so_name%g" \
513 -e "s%@shlib_dir@%$shlib_dir%g" \
514 -e "s%@shlib_slibdir_qual@%%g"
516 elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
517 shlib_base_name="libgcc_s";
518 shlibunwind_base_name="libunwind";
519 echo ""
520 echo "${shlib_base_name}${SHLIB_EXT}: $shlib_deps"
521 echo " $SHLIB_LINK" \
522 | sed -e "s%@multilib_flags@%$flags%g" \
523 -e "s%@multilib_dir@%$dir%g" \
524 -e "s%@shlib_objs@%$libgcc_sh_objs%g" \
525 -e "s%@shlib_base_name@%$shlib_base_name%g" \
526 -e "s%@shlib_map_file@%$mapfile%g" \
527 -e "s%@shlib_so_name@%$shlib_base_name%g" \
528 -e "s%@shlib_dir@%%g" \
529 -e "s%@shlib_slibdir_qual@%%g"
530 if [ "$LIBUNWIND" ]; then
531 echo ""
532 echo "${shlibunwind_base_name}${SHLIB_EXT}: $shlibunwind_deps"
533 echo " $SHLIBUNWIND_LINK" \
534 | sed -e "s%@multilib_flags@%$flags%g" \
535 -e "s%@multilib_dir@%$dir%g" \
536 -e "s%@shlib_objs@%$libgcc_sh_objs%g" \
537 -e "s%@shlib_base_name@%$shlibunwind_base_name%g" \
538 -e "s%@shlib_so_name@%$shlibunwind_base_name%g" \
539 -e "s%@shlib_dir@%%g" \
540 -e "s%@shlib_slibdir_qual@%%g"
544 done
546 dirs=libgcc
547 for ml in $MULTILIBS; do
548 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
549 if [ $dir != . ]; then
550 dirs="$dirs ${dir} libgcc/${dir}"
552 done
553 echo ''
554 echo 'libgcc-stage-start:'
555 echo ' for dir in '"${dirs}"'; do \'
556 echo ' if [ -d $(stage)/$$dir ]; then true; else '$mkinstalldirs' $(stage)/$$dir; fi; \'
557 echo ' done'
558 echo ' -for dir in '"${dirs}"'; do \'
559 echo ' mv $$dir/*'"${objext}"' $(stage)/$$dir; \'
560 echo ' test ! -f $$dir/stacknote.s || mv $$dir/stacknote.s $(stage)/$$dir; \'
561 echo ' test ! -f $$dir/libgcc.a || mv $$dir/lib* $(stage)/$$dir; \'
562 echo ' done'
564 echo ""
565 all=stmp-dirs
566 dirs=libgcc
568 for ml in $MULTILIBS; do
569 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
570 if [ $dir != . ]; then
571 dirs="$dirs ${dir} libgcc/${dir}"
573 all="$all ${dir}/libgcc.a ${dir}/libgcov.a"
574 if [ "$LIBUNWIND" ]; then
575 all="$all ${dir}/libunwind.a"
577 if [ "$SHLIB_LINK" ]; then
578 all="$all ${dir}/libgcc_eh.a"
579 if [ -z "$SHLIB_MULTILIB" ]; then
580 if [ "$dir" = "." ]; then
581 suff="";
582 else
583 suff=_`echo $dir | sed s,/,_,g`
585 all="$all ${dir}/libgcc_s${suff}${SHLIB_EXT}"
586 if [ "$LIBUNWIND" ]; then
587 all="$all ${dir}/${dir}/libunwind${suff}${SHLIB_EXT}"
589 elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
590 all="$all libgcc_s${SHLIB_EXT}"
591 if [ "$LIBUNWIND" ]; then
592 all="$all ${dir}/${dir}/libunwind${SHLIB_EXT}"
596 done
598 echo 'stmp-dirs: force'
599 echo ' for d in '"$dirs"'; do \'
600 echo ' if [ -d $$d ]; then true; else '$mkinstalldirs' $$d; fi; \'
601 echo ' done'
602 echo ' if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi'
604 for f in $EXTRA_MULTILIB_PARTS; do
605 for ml in $MULTILIBS; do
606 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
607 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
608 case $dir in
609 .) out=$f ; t= ;;
610 *) out=$dir/$f ; t=$dir/ ;;
611 esac
612 case $out in
613 # Prevent `make' from interpreting $out as a macro assignment
614 *'$(EQ)'*) targ="T_TARGET=$out T_TARGET" ;;
615 *) targ=$out ;;
616 esac
618 echo $out: stmp-dirs
619 echo " $make_compile" \\
620 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
621 echo ' MULTILIB_CFLAGS="'$flags'"' T=$t $targ
623 all="$all $out"
624 done
625 done
627 echo ""
628 echo "all: $all"
630 echo ""
631 echo "install: $all"
632 for ml in $MULTILIBS; do
633 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
634 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
635 if [ $dir != . ]; then
636 ldir='$(DESTDIR)$(libsubdir)'/$dir
637 echo " if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
638 else
639 ldir='$(DESTDIR)$(libsubdir)'
641 echo ' $(INSTALL_DATA)' ${dir}/libgcc.a ${ldir}/
642 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
643 echo ' $(INSTALL_DATA)' ${dir}/libgcov.a ${ldir}/
644 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
646 if [ "$SHLIB_LINK" ]; then
647 echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a ${ldir}/
648 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
650 if [ -z "$SHLIB_MULTILIB" ]; then
651 if [ "$dir" = . ]; then
652 shlib_base_name=libgcc_s
653 shlibunwind_base_name=libunwind
654 else
655 shlib_base_name=libgcc_s_`echo $dir | sed s,/,_,g`
656 shlibunwind_base_name=libunwind_`echo $dir | sed s,/,_,g`
658 shlib_so_name="$shlib_base_name"
659 shlibunwind_so_name="$shlibunwind_base_name"
660 shlib_dir=
661 shlib_slibdir_qual=
662 if [ -n "$MULTILIB_OSDIRNAMES" ]; then
663 gcc_multilib_dir=`./xgcc -B./ $flags --print-multi-directory`
664 os_multilib_dir=`./xgcc -B./ $flags --print-multi-os-directory`
665 if [ "$dir" != . ]; then
666 shlib_dir="$dir"/
668 gcc_multilib_sup=`echo $gcc_multilib_dir | sed 's~^[^/]*/~~'`
669 os_multilib_base=`echo $os_multilib_dir | sed -n "s~/${gcc_multilib_sup}\$~~p"`
670 if [ -z "$os_multilib_base" ]; then
671 shlib_so_name=libgcc_s
672 shlibunwind_so_name=libunwind
673 if [ "$os_multilib_dir" != "." ]; then
674 shlib_slibdir_qual="/$os_multilib_dir"
676 else
677 shlib_so_name=libgcc_s_`echo $gcc_multilib_sup | sed s,/,_,g`
678 shlibunwind_so_name=libunwind_`echo $gcc_multilib_sup | sed s,/,_,g`
679 shlib_slibdir_qual="/$os_multilib_base"
682 echo " $SHLIB_INSTALL" \
683 | sed -e "s%@shlib_base_name@%$shlib_base_name%g" \
684 -e "s%@shlib_so_name@%$shlib_so_name%g" \
685 -e "s%@shlib_dir@%$shlib_dir%g" \
686 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
687 if [ "$LIBUNWIND" ]; then
688 echo " $SHLIBUNWIND_INSTALL" \
689 | sed -e "s%@shlib_base_name@%$shlibunwind_base_name%g" \
690 -e "s%@shlib_so_name@%$shlibunwind_so_name%g" \
691 -e "s%@shlib_dir@%$shlib_dir%g" \
692 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
693 libunwinddir='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
694 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a ${libunwinddir}/
695 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
697 elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
698 shlib_base_name="libgcc_s";
699 echo " $SHLIB_INSTALL" \
700 | sed -e "s%@shlib_base_name@%$shlib_base_name%g" \
701 -e "s%@shlib_so_name@%$shlib_base_name%g" \
702 -e "s%@shlib_dir@%%g" \
703 -e "s%@shlib_slibdir_qual@%%g"
704 if [ "$LIBUNWIND" ]; then
705 echo " $SHLIBUNWIND_INSTALL" \
706 | sed -e "s%@shlib_base_name@%$shlibunwind_base_name%g" \
707 -e "s%@shlib_so_name@%$shlibunwind_base_name%g" \
708 -e "s%@shlib_dir@%%g" \
709 -e "s%@shlib_slibdir_qual@%%g"
710 libunwinddir='$(DESTDIR)$(slibdir)'
711 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a ${libunwinddir}/
712 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
716 done
717 for f in $EXTRA_MULTILIB_PARTS; do
718 for ml in $MULTILIBS; do
719 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
720 if [ $dir != . ]; then
721 out=${dir}/$f
722 ldir='$(DESTDIR)$(libsubdir)'/$dir
723 else
724 out=$f
725 ldir='$(DESTDIR)$(libsubdir)'
727 echo ' $(INSTALL_DATA)' $out $ldir/
728 done
729 done