2 # Construct makefile for libgcc.
3 # Copyright (C) 2000, 2002, 2003, 2004, 2005 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.
33 # EXTRA_MULTILIB_PARTS
44 # Make needs VPATH to be literal.
45 echo 'srcdir = @srcdir@'
46 echo 'VPATH = @srcdir@'
48 echo 'objects = $(filter %'$objext',$^)'
50 echo '# Dependencies are accumulated as we go.'
55 # Library members defined in libgcc2.c.
56 lib2funcs
='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
57 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi
58 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
59 _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache
60 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3
61 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
62 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
63 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
64 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
67 # Disable SHLIB_LINK if shared libgcc not enabled.
68 if [ "@enable_shared@" = "no" ]; then
74 gcc_compile
='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
75 gcc_s_compile
="$gcc_compile -DSHARED"
76 make_compile
='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
77 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
78 AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
79 AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
80 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
81 CC="$(CC)" CFLAGS="$(CFLAGS)" \
82 BUILD_PREFIX="$(BUILD_PREFIX)" \
83 BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \
84 LANGUAGES="$(LANGUAGES)"'
86 # Generic dependencies for libgcc
87 libgcc_dep
='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'
89 # Dependencies for libgcc2.c
90 libgcc2_c_dep
='stmp-dirs $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h gbl-ctors.h'" $libgcc_dep"
92 # Dependencies for libgcov.c
93 libgcov_c_dep
='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"
95 # Dependencies for fp-bit.c
96 fpbit_c_dep
='stmp-dirs config.status tsystem.h'
98 # Flag whether we need eh_dummy.c
101 if [ "$SHLIB_LINK" ]; then
102 # Test -fvisibility=hidden. We need both a -fvisibility=hidden on
103 # the command line, and a #define to prevent libgcc2.h etc from
104 # overriding that with #pragmas. The dance with @ is to prevent
105 # echo from seeing anything it might take for an option.
106 # echo turns the \$\$\$\$ into $$$$ and when make sees it it
107 # becomes $$ and the shell substitutes the pid. Makes for a
108 # slightly safer temp file.
109 echo "vis_hide := \$(strip \$(subst @,-,\\"
110 echo " \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
111 echo " $gcc_compile -fvisibility=hidden -Werror \\"
112 echo " -c -xc - -o vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
113 echo " then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
114 echo " rm vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
118 # If we have -fvisibility=hidden, then we need to generate hide
119 # lists for object files implemented in assembly. The default
120 # pseudo-op for this is ".hidden", but can be overridden with
122 [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP
=".hidden"
124 echo "ifneq (,\$(vis_hide))"
125 echo "define gen-hide-list"
126 echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
127 # non-GNU nm emits three fields even for undefined and typeless symbols,
128 # so explicitly omit them
129 echo " \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
130 echo "mv -f \$@T \$@"
133 echo "gen-hide-list = echo > \$@"
137 # It is too hard to guarantee that vis_hide and gen-hide-list will never
138 # be referenced if SHLIB_LINK is not set, so set them to the values they'd
139 # have if SHLIB_LINK were set and we didn't have visibility support.
141 echo "gen-hide-list = echo > \$@"
144 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
145 # defined as optimized assembly code in LIB1ASMFUNCS.
146 for name
in $LIB1ASMFUNCS; do
147 lib2funcs
=`echo $lib2funcs | sed -e 's/^'$name' //' \
148 -e 's/ '$name' / /' \
150 LIB2_DIVMOD_FUNCS
=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
151 -e 's/ '$name' / /' \
156 # Rules to generate object files.
159 for ml
in $MULTILIBS; do
161 # Work out relevant parameters that depend only on the multilib.
162 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
163 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
165 libgcc_a
=$dir/libgcc.a
166 libgcov_a
=$dir/libgcov.a
172 if [ "$LIBUNWIND" ]; then
173 libunwind_a
=$dir/libunwind.a
175 if [ "$SHLIB_LINK" ]; then
176 libgcc_eh_a
=$dir/libgcc_eh.a
177 libgcc_s_so
=$dir/libgcc_s
${SHLIB_EXT}
178 if [ "$LIBUNWIND" ]; then
179 libunwind_so
=$dir/libunwind
${SHLIB_EXT}
181 os_multilib_dir
=`./xgcc -B./ $flags --print-multi-os-directory`
182 if [ "$os_multilib_dir" != .
]; then
183 shlib_slibdir_qual
="/$os_multilib_dir"
194 echo \
# flags: $flags
195 echo \
# libgcc_a: $libgcc_a
196 echo \
# libgcov_a: $libgcov_a
197 echo \
# libgcc_eh_a: $libgcc_eh_a
198 echo \
# libunwind_a: $libunwind_a
200 echo \
# shlib_slibdir_qual: $shlib_slibdir_qual
201 echo \
# libgcc_s_so: $libgcc_s_so
202 echo \
# libunwind_so: $libunwind_so
206 # Update list of directories.
207 if [ $dir != .
]; then
208 echo "dirs += ${dir} libgcc/${dir}"
213 # Build libgcc1 components.
215 for name
in $LIB1ASMFUNCS; do
216 if [ "$libgcc_s_so" ]; then
217 out
="libgcc/${dir}/${name}${objext}"
218 outS
="libgcc/${dir}/${name}_s${objext}"
219 outV
="libgcc/${dir}/${name}.vis"
221 echo ${outS}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
222 echo " $gcc_s_compile" $flags -DL$name -xassembler-with-cpp \
223 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $outS
225 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)' ${outV}
226 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
227 -c '$(srcdir)/config/$(LIB1ASMSRC)' -include $outV -o $out
229 echo "${outV}: ${outS}; \$(gen-hide-list)"
232 echo $libgcc_s_so: $outS
233 if [ "$SHLIB_MKMAP" ]; then
234 echo libgcc
/${dir}/libgcc.map
: $outS
237 out
="libgcc/${dir}/${name}${objext}"
238 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
239 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
240 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
246 # Build libgcc2 components.
249 for name
in $lib2funcs; do
250 if [ "$libgcc_s_so" ]; then
251 out
="libgcc/${dir}/${name}${objext}"
252 outS
="libgcc/${dir}/${name}_s${objext}"
254 echo $outS: $libgcc2_c_dep
255 echo " $gcc_s_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' \
258 echo $out: $libgcc2_c_dep
259 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
260 -c '$(srcdir)/libgcc2.c' -o $out
263 echo $libgcc_s_so: $outS
264 if [ "$SHLIB_MKMAP" ]; then
265 echo libgcc
/${dir}/libgcc.map
: $outS
268 out
="libgcc/${dir}/${name}${objext}"
269 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
270 echo " $gcc_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $out
275 for name
in $LIB2FUNCS_ST; do
276 out
="libgcc/${dir}/${name}${objext}"
278 echo $out: $libgcc2_c_dep
279 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
280 -c '$(srcdir)/libgcc2.c' -o $out
281 echo ${dir}/libgcc.a
: $out
284 for name
in $LIB2_DIVMOD_FUNCS; do
285 if [ "$libgcc_s_so" ]; then
286 out
="libgcc/${dir}/${name}${objext}"
287 outS
="libgcc/${dir}/${name}_s${objext}"
289 echo $outS: $libgcc2_c_dep
290 echo " $gcc_s_compile" $flags -DL$name \
291 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
293 echo $out: $libgcc2_c_dep
294 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
295 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
298 echo $libgcc_s_so: $outS
299 if [ "$SHLIB_MKMAP" ]; then
300 echo libgcc
/${dir}/libgcc.map
: $outS
303 out
="libgcc/${dir}/${name}${objext}"
304 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
305 echo " $gcc_compile" $flags -DL$name \
306 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
312 # Build software floating point functions.
315 if [ "$FPBIT" ]; then
316 for name
in $FPBIT_FUNCS; do
317 if [ "$libgcc_s_so" ]; then
318 out
="libgcc/${dir}/${name}${objext}"
319 outS
="libgcc/${dir}/${name}_s${objext}"
321 echo $outS: $FPBIT $fpbit_c_dep
322 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
325 echo $out: $FPBIT $fpbit_c_dep
326 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
327 '$(vis_hide)' -c $FPBIT -o $out
330 echo $libgcc_s_so: $outS
331 if [ "$SHLIB_MKMAP" ]; then
332 echo libgcc
/${dir}/libgcc.map
: $outS
335 out
="libgcc/${dir}/${name}${objext}"
336 echo $out: $FPBIT $fpbit_c_dep
337 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
345 if [ "$DPBIT" ]; then
346 for name
in $DPBIT_FUNCS; do
347 if [ "$libgcc_s_so" ]; then
348 out
="libgcc/${dir}/${name}${objext}"
349 outS
="libgcc/${dir}/${name}_s${objext}"
351 echo $outS: $DPBIT $fpbit_c_dep
352 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
355 echo $out: $DPBIT $fpbit_c_dep
356 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
357 '$(vis_hide)' -c $DPBIT -o $out
360 echo $libgcc_s_so: $outS
361 if [ "$SHLIB_MKMAP" ]; then
362 echo libgcc
/${dir}/libgcc.map
: $outS
365 out
="libgcc/${dir}/${name}${objext}"
366 echo $out: $DPBIT $fpbit_c_dep
367 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
375 if [ "$TPBIT" ]; then
376 for name
in $TPBIT_FUNCS; do
377 if [ "$libgcc_s_so" ]; then
378 out
="libgcc/${dir}/${name}${objext}"
379 outS
="libgcc/${dir}/${name}_s${objext}"
381 echo $outS: $TPBIT $fpbit_c_dep
382 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
385 echo $out: $TPBIT $fpbit_c_dep
386 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
387 '$(vis_hide)' -c $TPBIT -o $out
390 echo $libgcc_s_so: $outS
391 if [ "$SHLIB_MKMAP" ]; then
392 echo libgcc
/${dir}/libgcc.map
: $outS
395 out
="libgcc/${dir}/${name}${objext}"
396 echo $out: $TPBIT $fpbit_c_dep
397 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
405 for file in $LIB2ADD; do
406 name
=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
407 oname
=`echo $name | sed -e 's,.*/,,'`
409 if [ "$libgcc_s_so" ]; then
410 out
="libgcc/${dir}/${oname}${objext}"
411 outS
="libgcc/${dir}/${oname}_s${objext}"
415 echo $outS: stmp-dirs
$file $libgcc_dep
416 echo " $gcc_s_compile" $flags -c $file -o $outS
418 echo $out: stmp-dirs
$file $libgcc_dep
419 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
423 outV
="libgcc/${dir}/${oname}.vis"
425 echo $outS: stmp-dirs
$file $libgcc_dep
426 echo " $gcc_s_compile" $flags -xassembler-with-cpp \
429 echo $out: stmp-dirs
$file $libgcc_dep $outV
430 echo " $gcc_compile" $flags -xassembler-with-cpp \
431 -include $outV -c $file -o $out
432 echo "${outV}: ${outS}; \$(gen-hide-list)"
436 echo "Unhandled extension: $file" >&2
442 echo $libgcc_s_so: $outS
443 if [ "$SHLIB_MKMAP" ]; then
444 echo libgcc
/${dir}/libgcc.map
: $outS
447 out
="libgcc/${dir}/${oname}${objext}"
450 echo $out: stmp-dirs
$file $libgcc_dep
451 echo " $gcc_compile" $flags -c $file -o $out
455 echo $out: stmp-dirs
$file $libgcc_dep
456 echo " $gcc_compile" $flags -xassembler-with-cpp \
461 echo "Unhandled extension: $file" >&2
471 for file in $LIB2ADD_ST; do
472 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
473 oname
=`echo $name | sed -e 's,.*/,,'`
474 out
="libgcc/${dir}/${oname}${objext}"
478 echo $out: stmp-dirs
$file $libgcc_dep
479 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
483 # We may have to compile it twice in order to establish the list
484 # of symbols to be marked hidden.
485 if [ "$libgcc_so" ]; then
486 outV
="libgcc/${dir}/${oname}.vis"
487 outT
="libgcc/${dir}/${oname}_t${objext}"
488 echo ${outT}: stmp-dirs
$file $libgcc_dep
489 echo " $gcc_compile" $flags -xassembler-with-cpp \
491 echo $out: stmp-dirs
$file $libgcc_dep $outV
492 echo " $gcc_compile" $flags -xassembler-with-cpp \
493 -include $outV -c $file -o $out
494 echo "${outV}: ${outT}; \$(gen-hide-list)"
496 echo $out: stmp-dirs
$file $libgcc_dep
497 echo " $gcc_compile" $flags -xassembler-with-cpp \
503 echo "Unhandled extension: $file" >&2
510 # If we don't have libgcc_eh.a, only LIB2ADDEH matters. If we do, only
511 # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter. (Usually all three are
512 # identical.) We do _not_ handle assembly files in this context.
514 if [ "$libgcc_eh_a" ]; then
515 for file in $LIB2ADDEHSTATIC; do
518 *) echo "Unhandled extension: $file">&2; exit 1 ;;
521 name
=`echo $file | sed -e 's/[.]c$//'`
522 oname
=`echo $name | sed -e 's,.*/,,'`
523 out
="libgcc/${dir}/${oname}${objext}"
525 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
526 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
527 echo $libgcc_eh_a: $out
530 for file in $LIB2ADDEHSHARED; do
533 *) echo "Unhandled extension: $file">&2; exit 1 ;;
536 name
=`echo $file | sed -e 's/[.]c$//'`
537 oname
=`echo $name | sed -e 's,.*/,,'`
538 outS
="libgcc/${dir}/${oname}_s${objext}"
540 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
541 echo " $gcc_s_compile" $flags -fexceptions -c $file -o $outS
542 echo $libgcc_s_so: $outS
543 if [ "$SHLIB_MKMAP" ]; then
544 echo libgcc
/${dir}/libgcc.map
: $outS
548 # If nothing went into libgcc_eh.a, create a dummy object -
549 # some linkers don't like totally empty archives.
550 if [ -z "$LIB2ADDEHSTATIC" ]; then
552 out
="libgcc/${dir}/eh_dummy${objext}"
555 echo $out: stmp-dirs
$file
556 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
557 echo $libgcc_eh_a: $out
561 else # no libgcc_eh.a
562 for file in $LIB2ADDEH; do
565 *) echo "Unhandled extension: $file">&2; exit 1 ;;
568 name
=`echo $file | sed -e 's/[.]c$//'`
569 oname
=`echo $name | sed -e 's,.*/,,'`
570 out
="libgcc/${dir}/${oname}${objext}"
572 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
573 echo " $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
578 # Again, this does not handle assembly.
579 if [ "$LIBUNWIND" ]; then
580 for file in $LIBUNWIND; do
583 *) echo "Unhandled extension: $file">&2; exit 1 ;;
586 name
=`echo $file | sed -e 's/[.]c$//'`
587 oname
=`echo $name | sed -e 's,.*/,,'`
589 if [ "$libunwind_so" ]; then
590 out
="libgcc/${dir}/${oname}${objext}"
591 outS
="libgcc/${dir}/${oname}_s${objext}"
593 echo $out: stmp-dirs
$file $LIBUNWINDDEP
594 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
596 echo $outS: stmp-dirs
$file $LIBUNWINDDEP
597 echo " $gcc_s_compile $flags -fexceptions -c $file -o $outS"
599 echo $libunwind_a: $out
600 echo $libunwind_so: $outS
602 out
="libgcc/${dir}/${oname}${objext}"
603 echo $out: stmp-dirs
$file $LIBUNWINDDEP
604 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
605 echo $libunwind_a: $out
611 # build libgcov components
613 for name
in $LIBGCOV; do
614 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
615 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
616 out
="libgcc/${dir}/${name}${objext}"
618 echo $out: $libgcov_c_dep
619 echo " $gcc_compile $flags -DL$name -c \$(srcdir)/libgcov.c -o $out"
620 echo $libgcov_a: $out
623 # EXTRA_MULTILIB_PARTS.
624 if [ -n "$EXTRA_MULTILIB_PARTS" ]; then
625 # Each of the EXTRA_MULTILIB_PARTS is built by recursive invocation
626 # of the parent Makefile. We must do this just once for each
627 # multilib, passing it all the EXTRA_MULTILIB_PARTS as
628 # simultaneous goal targets, so that rules which cannot execute
629 # simultaneously are properly serialized.
633 for f
in $EXTRA_MULTILIB_PARTS; do
636 *) out
=$dir/$f ; t
=$dir/ ;;
639 # Prevent `make' from interpreting $out as a macro assignment
640 *'$(EQ)'*) targ
="T_TARGET=$out T_TARGET" ;;
646 if [ "$dir" = .
]; then
649 suffix
=`echo $dir | sed s,/,_,g`
651 echo extra
$suffix: stmp-dirs
652 echo " $make_compile" \\
653 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
654 echo ' MULTILIB_CFLAGS="'$flags'"' T
=$t $extra
655 echo "all: extra$suffix"
657 # Make libunwind.so and libgcc_s.so depend on these, since they
658 # are likely to be implicitly used by the link process.
659 if [ "$libgcc_s_so" ]; then
660 echo "$libgcc_s_so: extra$suffix"
662 if [ "$libunwind_so" ]; then
663 echo "$libunwind_so: extra$suffix"
667 # Library build rules.
668 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
669 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
671 # Map-file generation.
672 if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
673 mapfile
="libgcc/${dir}/libgcc.map"
674 tmpmapfile
="libgcc/${dir}/tmp-libgcc.map"
675 # This uses a here document instead of echos because some shells
676 # will convert the \1 in the second sed command to a control-A.
677 # The behavior of here documents is more predictable.
680 ${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES
681 { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS \$(objects); echo %%; \\
682 cat $SHLIB_MAPFILES \\
683 | sed -e '/^[ ]*#/d' \\
684 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
685 | $gcc_compile $flags -E -xassembler-with-cpp -; \\
686 } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
688 $libgcc_s_so: ${mapfile}
694 # Each of these .a files depends on stmp-dirs. It would seem that
695 # this dependency is redundant, since each of the object files
696 # itself depends on stmp-dirs. However, it is possible that there
697 # are in fact no object files. In that case, the stmp-dirs
698 # dependency is required; the directory containing the archive must
699 # exist before the archive itself can be created.
701 echo "$libgcc_a: stmp-dirs"
702 echo " -rm -f $libgcc_a"
703 echo ' $(AR_CREATE_FOR_TARGET)' $libgcc_a '$(objects)'
704 echo ' $(RANLIB_FOR_TARGET)' $libgcc_a
705 echo "all: $libgcc_a"
708 echo "$libgcov_a: stmp-dirs"
709 echo " -rm -f $libgcov_a"
710 echo ' $(AR_CREATE_FOR_TARGET)' $libgcov_a '$(objects)'
711 echo ' $(RANLIB_FOR_TARGET)' $libgcov_a
712 echo "all: $libgcov_a"
714 # These libraries are not always built.
715 if [ "$libunwind_a" ]; then
717 echo "$libunwind_a: stmp-dirs"
718 echo " -rm -f $libunwind_a"
719 echo ' $(AR_CREATE_FOR_TARGET)' $libunwind_a '$(objects)'
720 echo ' $(RANLIB_FOR_TARGET)' $libunwind_a
721 echo "all: $libunwind_a"
724 if [ "$libgcc_eh_a" ]; then
726 echo "${dir}/libgcc_eh.a: stmp-dirs"
727 echo " -rm -f ${dir}/libgcc_eh.a"
728 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a
'$(objects)'
729 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
730 echo "all: $libgcc_eh_a"
734 if [ "$libgcc_s_so" ]; then
736 echo "$libgcc_s_so: stmp-dirs $libunwind_so"
737 echo " $SHLIB_LINK" \
738 |
sed -e "s%@multilib_flags@%$flags%g" \
739 -e "s%@multilib_dir@%$dir%g" \
740 -e "s%@shlib_objs@%\$(objects)%g" \
741 -e "s%@shlib_base_name@%libgcc_s%g" \
742 -e "s%@shlib_map_file@%$mapfile%g" \
743 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
744 echo "all: $libgcc_s_so"
747 if [ "$libunwind_so" ]; then
749 echo "$libunwind_so: stmp-dirs"
750 echo " $SHLIBUNWIND_LINK" \
751 |
sed -e "s%@multilib_flags@%$flags%g" \
752 -e "s%@multilib_dir@%$dir%g" \
753 -e "s%@shlib_objs@%\$(objects)%g" \
754 -e "s%@shlib_base_name@%libunwind%g" \
755 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
756 echo "all: $libunwind_so"
759 done # ml in MULTILIBS
762 echo "libgcc-stage-start:"
763 echo " for dir in \$(dirs); do \\"
764 echo " if [ -d \$(stage)/\$\$dir ]; then :; \\"
765 echo " else $mkinstalldirs \$(stage)/\$\$dir; fi; \\"
767 echo " -for dir in \$(dirs); do \\"
768 echo " mv \$\$dir/*${objext} \$(stage)/\$\$dir; \\"
769 echo " mv \$\$dir/*.vis \$(stage)/\$\$dir; \\"
770 echo " mv \$\$dir/*.map \$(stage)/\$\$dir; \\"
771 echo " test ! -f \$\$dir/libgcc.a || mv \$\$dir/lib* \$(stage)/\$\$dir; \\"
776 echo " for d in \$(dirs); do \\"
777 echo " if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
779 echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
781 if [ "$need_eh_dummy" ]; then
783 echo " echo 'struct eh_dummy;' > \$@"
788 for ml
in $MULTILIBS; do
789 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
790 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
791 if [ $dir != .
]; then
792 ldir
='$(DESTDIR)$(libsubdir)'/$dir
793 echo " if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
795 ldir
='$(DESTDIR)$(libsubdir)'
797 echo ' $(INSTALL_DATA)' ${dir}/libgcc.a
${ldir}/
798 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
799 echo ' $(INSTALL_DATA)' ${dir}/libgcov.a
${ldir}/
800 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
802 if [ "$SHLIB_LINK" ]; then
803 echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a
${ldir}/
804 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
807 os_multilib_dir
=`./xgcc -B./ $flags --print-multi-os-directory`
808 if [ "$os_multilib_dir" != .
]; then
809 shlib_slibdir_qual
="/$os_multilib_dir"
811 echo " $SHLIB_INSTALL" \
812 |
sed -e "s%@multilib_dir@%$dir%g" \
813 -e "s%@shlib_base_name@%libgcc_s%g" \
814 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
815 if [ "$LIBUNWIND" ]; then
816 echo " $SHLIBUNWIND_INSTALL" \
817 |
sed -e "s%@multilib_dir@%$dir%g" \
818 -e "s%@shlib_base_name@%libunwind%g" \
819 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
820 libunwinddir
='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
821 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a
${libunwinddir}/
822 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
826 for f
in $EXTRA_MULTILIB_PARTS; do
827 for ml
in $MULTILIBS; do
828 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
829 if [ $dir != .
]; then
831 ldir
='$(DESTDIR)$(libsubdir)'/$dir
834 ldir
='$(DESTDIR)$(libsubdir)'
836 echo ' $(INSTALL_DATA)' $out $ldir/
840 echo '.PHONY: all install'