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.
39 # EXTRA_MULTILIB_PARTS
51 # Make needs VPATH to be literal.
52 echo 'srcdir = @srcdir@'
53 echo 'VPATH = @srcdir@'
55 echo 'objects = $(filter %'$objext',$^)'
57 echo '# Dependencies are accumulated as we go.'
62 # Library members defined in libgcc2.c.
63 lib2funcs='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
64 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi
65 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
66 _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache
67 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3
68 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
69 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
70 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
71 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
72 _divxc3 _divtc3 _floatundidf _floatundisf _floatundixf _floatunditf'
74 # Disable SHLIB_LINK if shared libgcc not enabled.
75 if [ "@enable_shared@" = "no" ]; then
81 gcc_compile='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
82 gcc_s_compile="$gcc_compile -DSHARED"
83 make_compile='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
84 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
85 AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
86 AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
87 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
88 CC="$(CC)" CFLAGS="$(CFLAGS)" \
89 BUILD_PREFIX="$(BUILD_PREFIX)" \
90 BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \
91 LANGUAGES="$(LANGUAGES)"'
93 # Generic dependencies for libgcc
94 libgcc_dep='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'
96 # Dependencies for libgcc2.c
97 libgcc2_c_dep='stmp-dirs $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h gbl-ctors.h'" $libgcc_dep"
99 # Dependencies for libgcov.c
100 libgcov_c_dep='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"
102 # Dependencies for fp-bit.c
103 fpbit_c_dep='stmp-dirs config.status tsystem.h'
105 # Dependencies for decnumber and friends. This is an overzealous set,
106 # but at least we can be sure to recompile if anything gets modified.
107 decnumber_dep='stmp-dirs $(srcdir)/../libdecnumber/decContext.h $(srcdir)/../libdecnumber/decNumber.h
108 $(srcdir)/../libdecnumber/decNumberLocal.h $(srcdir)/../libdecnumber/decimal32.h $(srcdir)/../libdecnumber/decimal64.h
109 $(srcdir)/../libdecnumber/decimal128.h $(srcdir)/../libdecnumber/decDPD.h $(srcdir)/../libdecnumber/decUtility.h'
111 # Flag whether we need eh_dummy.c
114 if [ "$SHLIB_LINK" ]; then
115 # Test -fvisibility=hidden. We need both a -fvisibility=hidden on
116 # the command line, and a #define to prevent libgcc2.h etc from
117 # overriding that with #pragmas. The dance with @ is to prevent
118 # echo from seeing anything it might take for an option.
119 # echo turns the \$\$\$\$ into $$$$ and when make sees it it
120 # becomes $$ and the shell substitutes the pid. Makes for a
121 # slightly safer temp file.
122 echo "vis_hide := \$(strip \$(subst @,-,\\"
123 echo " \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
124 echo " $gcc_compile -fvisibility=hidden -Werror \\"
125 echo " -c -xc - -o vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
126 echo " then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
127 echo " rm vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
131 # If we have -fvisibility=hidden, then we need to generate hide
132 # lists for object files implemented in assembly. The default
133 # pseudo-op for this is ".hidden", but can be overridden with
135 [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP=".hidden"
137 echo "ifneq (,\$(vis_hide))"
138 echo "define gen-hide-list"
139 echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
140 # non-GNU nm emits three fields even for undefined and typeless symbols,
141 # so explicitly omit them
142 echo " \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
143 echo "mv -f \$@T \$@"
146 echo "gen-hide-list = echo > \$@"
150 # It is too hard to guarantee that vis_hide and gen-hide-list will never
151 # be referenced if SHLIB_LINK is not set, so set them to the values they'd
152 # have if SHLIB_LINK were set and we didn't have visibility support.
154 echo "gen-hide-list = echo > \$@"
157 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
158 # defined as optimized assembly code in LIB1ASMFUNCS.
159 for name in $LIB1ASMFUNCS; do
160 lib2funcs=`echo $lib2funcs | sed -e 's/^'$name' //' \
161 -e 's/ '$name' / /' \
163 LIB2_DIVMOD_FUNCS=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
164 -e 's/ '$name' / /' \
169 # Rules to generate object files.
172 for ml in $MULTILIBS; do
174 # Work out relevant parameters that depend only on the multilib.
175 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
176 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
178 libgcc_a=$dir/libgcc.a
179 libgcov_a=$dir/libgcov.a
185 if [ "$LIBUNWIND" ]; then
186 libunwind_a=$dir/libunwind.a
188 if [ "$SHLIB_LINK" ]; then
189 libgcc_eh_a=$dir/libgcc_eh.a
190 libgcc_s_so=$dir/libgcc_s${SHLIB_EXT}
191 if [ "$LIBUNWIND" ]; then
192 libunwind_so=$dir/libunwind${SHLIB_EXT}
194 os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
195 if [ "$os_multilib_dir" != . ]; then
196 shlib_slibdir_qual="/$os_multilib_dir"
207 echo \# flags: $flags
208 echo \# libgcc_a: $libgcc_a
209 echo \# libgcov_a: $libgcov_a
210 echo \# libgcc_eh_a: $libgcc_eh_a
211 echo \# libunwind_a: $libunwind_a
213 echo \# shlib_slibdir_qual: $shlib_slibdir_qual
214 echo \# libgcc_s_so: $libgcc_s_so
215 echo \# libunwind_so: $libunwind_so
219 # Update list of directories.
220 if [ $dir != . ]; then
221 echo "dirs += ${dir} libgcc/${dir}"
226 # Build libgcc1 components.
228 for name in $LIB1ASMFUNCS; do
229 if [ "$libgcc_s_so" ]; then
230 out="libgcc/${dir}/${name}${objext}"
231 outS="libgcc/${dir}/${name}_s${objext}"
232 outV="libgcc/${dir}/${name}.vis"
234 echo ${outS}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
235 echo " $gcc_s_compile" $flags -DL$name -xassembler-with-cpp \
236 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $outS
238 echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)' ${outV}
239 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
240 -c '$(srcdir)/config/$(LIB1ASMSRC)' -include $outV -o $out
242 echo "${outV}: ${outS}; \$(gen-hide-list)"
245 echo $libgcc_s_so: $outS
246 if [ "$SHLIB_MKMAP" ]; then
247 echo libgcc/${dir}/libgcc.map: $outS
250 out="libgcc/${dir}/${name}${objext}"
251 echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
252 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
253 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
259 # Build libgcc2 components.
262 for name in $lib2funcs; do
263 if [ "$libgcc_s_so" ]; then
264 out="libgcc/${dir}/${name}${objext}"
265 outS="libgcc/${dir}/${name}_s${objext}"
267 echo $outS: $libgcc2_c_dep
268 echo " $gcc_s_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' \
271 echo $out: $libgcc2_c_dep
272 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
273 -c '$(srcdir)/libgcc2.c' -o $out
276 echo $libgcc_s_so: $outS
277 if [ "$SHLIB_MKMAP" ]; then
278 echo libgcc/${dir}/libgcc.map: $outS
281 out="libgcc/${dir}/${name}${objext}"
282 echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
283 echo " $gcc_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $out
288 for name in $LIB2FUNCS_ST; do
289 out="libgcc/${dir}/${name}${objext}"
291 echo $out: $libgcc2_c_dep
292 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
293 -c '$(srcdir)/libgcc2.c' -o $out
294 echo ${dir}/libgcc.a: $out
297 for name in $LIB2_DIVMOD_FUNCS; do
298 if [ "$libgcc_s_so" ]; then
299 out="libgcc/${dir}/${name}${objext}"
300 outS="libgcc/${dir}/${name}_s${objext}"
302 echo $outS: $libgcc2_c_dep
303 echo " $gcc_s_compile" $flags -DL$name \
304 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
306 echo $out: $libgcc2_c_dep
307 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
308 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
311 echo $libgcc_s_so: $outS
312 if [ "$SHLIB_MKMAP" ]; then
313 echo libgcc/${dir}/libgcc.map: $outS
316 out="libgcc/${dir}/${name}${objext}"
317 echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
318 echo " $gcc_compile" $flags -DL$name \
319 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
325 # Build software floating point functions.
328 for fpbit_var in FPBIT DPBIT TPBIT ; do
329 fpfuncs_var="${fpbit_var}_FUNCS"
330 eval fpbit=\$$fpbit_var
331 eval fpfuncs=\$$fpfuncs_var
333 if [ "$fpbit" ] ; then
334 for name in $fpfuncs; do
335 if [ "$libgcc_s_so" ]; then
336 out="libgcc/${dir}/${name}${objext}"
337 outS="libgcc/${dir}/${name}_s${objext}"
339 echo $outS: $fpbit $fpbit_c_dep
340 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
343 echo $out: $fpbit $fpbit_c_dep
344 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
345 '$(vis_hide)' -c $fpbit -o $out
348 echo $libgcc_s_so: $outS
349 if [ "$SHLIB_MKMAP" ]; then
350 echo libgcc/${dir}/libgcc.map: $outS
353 out="libgcc/${dir}/${name}${objext}"
354 echo $out: $fpbit $fpbit_c_dep
355 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
364 if [ "@enable_decimal_float@" = "yes" -a -z "$libgcc_so" ]; then
365 # Bring in the DFP support code if D32PBIT, D64PBIT or D128PBIT are set.
366 if [ -n "$D32PBIT" -o -n "$D64PBIT" -o -n "$D128PBIT" ] ; then
367 dec_filenames="decContext decNumber decRound decLibrary decUtility"
370 # Only bring in decimal*.c files for types we support.
371 if [ -n "$D32PBIT" ] ; then
372 dec_filenames="$dec_filenames decimal32"
374 if [ -n "$D64PBIT" ] ; then
375 dec_filenames="$dec_filenames decimal64"
377 if [ -n "$D128PBIT" ] ; then
378 dec_filenames="$dec_filenames decimal128"
381 for name in $dec_filenames ; do
382 out="libgcc/${dir}/${name}${objext}"
383 echo $out: "\$(srcdir)/../libdecnumber/${name}.c" $decnumber_dep
384 echo " $gcc_compile" $flags -c "\$(srcdir)/../libdecnumber/${name}.c" -o $out
388 # For individual functions, loop over each variable by name.
389 for dpbit_var in D32PBIT D64PBIT D128PBIT ; do
390 dpfuncs_var="${dpbit_var}_FUNCS"
391 eval dpbit=\$$dpbit_var
392 eval dpfuncs=\$$dpfuncs_var
394 if [ "$dpbit" ]; then
395 for name in $dpfuncs; do
396 out="libgcc/${dir}/${name}${objext}"
397 echo $out: $dpbit $fpbit_c_dep
398 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
407 for file in $LIB2ADD; do
408 name=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
409 oname=`echo $name | sed -e 's,.*/,,'`
411 if [ "$libgcc_s_so" ]; then
412 out="libgcc/${dir}/${oname}${objext}"
413 outS="libgcc/${dir}/${oname}_s${objext}"
417 echo $outS: stmp-dirs $file $libgcc_dep
418 echo " $gcc_s_compile" $flags -c $file -o $outS
420 echo $out: stmp-dirs $file $libgcc_dep
421 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
425 outV="libgcc/${dir}/${oname}.vis"
427 echo $outS: stmp-dirs $file $libgcc_dep
428 echo " $gcc_s_compile" $flags -xassembler-with-cpp \
431 echo $out: stmp-dirs $file $libgcc_dep $outV
432 echo " $gcc_compile" $flags -xassembler-with-cpp \
433 -include $outV -c $file -o $out
434 echo "${outV}: ${outS}; \$(gen-hide-list)"
438 echo "Unhandled extension: $file" >&2
444 echo $libgcc_s_so: $outS
445 if [ "$SHLIB_MKMAP" ]; then
446 echo libgcc/${dir}/libgcc.map: $outS
449 out="libgcc/${dir}/${oname}${objext}"
452 echo $out: stmp-dirs $file $libgcc_dep
453 echo " $gcc_compile" $flags -c $file -o $out
457 echo $out: stmp-dirs $file $libgcc_dep
458 echo " $gcc_compile" $flags -xassembler-with-cpp \
463 echo "Unhandled extension: $file" >&2
473 for file in $LIB2ADD_ST; do
474 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
475 oname=`echo $name | sed -e 's,.*/,,'`
476 out="libgcc/${dir}/${oname}${objext}"
480 echo $out: stmp-dirs $file $libgcc_dep
481 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
485 # We may have to compile it twice in order to establish the list
486 # of symbols to be marked hidden.
487 if [ "$libgcc_so" ]; then
488 outV="libgcc/${dir}/${oname}.vis"
489 outT="libgcc/${dir}/${oname}_t${objext}"
490 echo ${outT}: stmp-dirs $file $libgcc_dep
491 echo " $gcc_compile" $flags -xassembler-with-cpp \
493 echo $out: stmp-dirs $file $libgcc_dep $outV
494 echo " $gcc_compile" $flags -xassembler-with-cpp \
495 -include $outV -c $file -o $out
496 echo "${outV}: ${outT}; \$(gen-hide-list)"
498 echo $out: stmp-dirs $file $libgcc_dep
499 echo " $gcc_compile" $flags -xassembler-with-cpp \
505 echo "Unhandled extension: $file" >&2
512 # If we don't have libgcc_eh.a, only LIB2ADDEH matters. If we do, only
513 # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter. (Usually all three are
516 if [ "$libgcc_eh_a" ]; then
517 for file in $LIB2ADDEHSTATIC; do
518 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
519 oname=`echo $name | sed -e 's,.*/,,'`
520 out="libgcc/${dir}/${oname}${objext}"
524 echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
525 echo " $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
528 # We have to compile it twice in order to establish the list
529 # of symbols to be marked hidden.
530 outV="libgcc/${dir}/${oname}.vis"
531 outT="libgcc/${dir}/${oname}_t${objext}"
532 echo ${outT}: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
533 echo " $gcc_compile" $flags -xassembler-with-cpp \
535 echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep $outV
536 echo " $gcc_compile" $flags -xassembler-with-cpp \
537 -include $outV -c $file -o $out
538 echo "${outV}: ${outT}; \$(gen-hide-list)"
540 *) echo "Unhandled extension: $file">&2; exit 1 ;;
543 echo $libgcc_eh_a: $out
546 for file in $LIB2ADDEHSHARED; do
547 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
548 oname=`echo $name | sed -e 's,.*/,,'`
549 outS="libgcc/${dir}/${oname}_s${objext}"
553 echo $outS: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
554 echo " $gcc_s_compile" $flags -fexceptions -c $file -o $outS
557 echo $outS: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
558 echo " $gcc_s_compile" $flags -xassembler-with-cpp -c $file -o $outS
560 *) echo "Unhandled extension: $file">&2; exit 1 ;;
563 echo $libgcc_s_so: $outS
564 if [ "$SHLIB_MKMAP" ]; then
565 echo libgcc/${dir}/libgcc.map: $outS
569 # If nothing went into libgcc_eh.a, create a dummy object -
570 # some linkers don't like totally empty archives.
571 if [ -z "$LIB2ADDEHSTATIC" ]; then
573 out="libgcc/${dir}/eh_dummy${objext}"
576 echo $out: stmp-dirs $file
577 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
578 echo $libgcc_eh_a: $out
582 else # no libgcc_eh.a
583 for file in $LIB2ADDEH; do
584 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
585 oname=`echo $name | sed -e 's,.*/,,'`
586 out="libgcc/${dir}/${oname}${objext}"
590 echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
591 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
594 echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
595 echo " $gcc_compile" $flags -xassembler-with-cpp \
598 *) echo "Unhandled extension: $file">&2; exit 1 ;;
605 # We do _not_ handle assembly files in this context.
606 if [ "$LIBUNWIND" ]; then
607 for file in $LIBUNWIND; do
610 *) echo "Unhandled extension: $file">&2; exit 1 ;;
613 name=`echo $file | sed -e 's/[.]c$//'`
614 oname=`echo $name | sed -e 's,.*/,,'`
616 if [ "$libunwind_so" ]; then
617 out="libgcc/${dir}/${oname}${objext}"
618 outS="libgcc/${dir}/${oname}_s${objext}"
620 echo $out: stmp-dirs $file $LIBUNWINDDEP
621 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
623 echo $outS: stmp-dirs $file $LIBUNWINDDEP
624 echo " $gcc_s_compile $flags -fexceptions -c $file -o $outS"
626 echo $libunwind_a: $out
627 echo $libunwind_so: $outS
629 out="libgcc/${dir}/${oname}${objext}"
630 echo $out: stmp-dirs $file $LIBUNWINDDEP
631 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
632 echo $libunwind_a: $out
638 # build libgcov components
640 for name in $LIBGCOV; do
641 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
642 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
643 out="libgcc/${dir}/${name}${objext}"
645 echo $out: $libgcov_c_dep
646 echo " $gcc_compile $flags -DL$name -c \$(srcdir)/libgcov.c -o $out"
647 echo $libgcov_a: $out
650 # EXTRA_MULTILIB_PARTS.
651 if [ -n "$EXTRA_MULTILIB_PARTS" ]; then
652 # Each of the EXTRA_MULTILIB_PARTS is built by recursive invocation
653 # of the parent Makefile. We must do this just once for each
654 # multilib, passing it all the EXTRA_MULTILIB_PARTS as
655 # simultaneous goal targets, so that rules which cannot execute
656 # simultaneously are properly serialized.
660 for f in $EXTRA_MULTILIB_PARTS; do
663 *) out=$dir/$f ; t=$dir/ ;;
666 # Prevent `make' from interpreting $out as a macro assignment
667 *'$(EQ)'*) targ="T_TARGET=$out T_TARGET" ;;
673 if [ "$dir" = . ]; then
676 suffix=`echo $dir | sed s,/,_,g`
678 echo extra$suffix: stmp-dirs
679 echo " $make_compile" \\
680 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
681 echo ' MULTILIB_CFLAGS="'$flags'"' T=$t $extra
682 echo "all: extra$suffix"
684 # Make libunwind.so and libgcc_s.so depend on these, since they
685 # are likely to be implicitly used by the link process.
686 if [ "$libgcc_s_so" ]; then
687 echo "$libgcc_s_so: extra$suffix"
689 if [ "$libunwind_so" ]; then
690 echo "$libunwind_so: extra$suffix"
694 # Library build rules.
695 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
696 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
698 # Map-file generation.
699 if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
700 mapfile="libgcc/${dir}/libgcc.map"
701 tmpmapfile="libgcc/${dir}/tmp-libgcc.map"
702 # This uses a here document instead of echos because some shells
703 # will convert the \1 in the second sed command to a control-A.
704 # The behavior of here documents is more predictable.
707 ${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES
708 { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS \$(objects); echo %%; \\
709 cat $SHLIB_MAPFILES \\
710 | sed -e '/^[ ]*#/d' \\
711 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
712 | $gcc_compile $flags -E -xassembler-with-cpp -; \\
713 } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
715 $libgcc_s_so: ${mapfile}
721 # Each of these .a files depends on stmp-dirs. It would seem that
722 # this dependency is redundant, since each of the object files
723 # itself depends on stmp-dirs. However, it is possible that there
724 # are in fact no object files. In that case, the stmp-dirs
725 # dependency is required; the directory containing the archive must
726 # exist before the archive itself can be created.
728 echo "$libgcc_a: stmp-dirs"
729 echo " -rm -f $libgcc_a"
730 echo ' $(AR_CREATE_FOR_TARGET)' $libgcc_a '$(objects)'
731 echo ' $(RANLIB_FOR_TARGET)' $libgcc_a
732 echo "all: $libgcc_a"
735 echo "$libgcov_a: stmp-dirs"
736 echo " -rm -f $libgcov_a"
737 echo ' $(AR_CREATE_FOR_TARGET)' $libgcov_a '$(objects)'
738 echo ' $(RANLIB_FOR_TARGET)' $libgcov_a
739 echo "all: $libgcov_a"
741 # These libraries are not always built.
742 if [ "$libunwind_a" ]; then
744 echo "$libunwind_a: stmp-dirs"
745 echo " -rm -f $libunwind_a"
746 echo ' $(AR_CREATE_FOR_TARGET)' $libunwind_a '$(objects)'
747 echo ' $(RANLIB_FOR_TARGET)' $libunwind_a
748 echo "all: $libunwind_a"
751 if [ "$libgcc_eh_a" ]; then
753 echo "${dir}/libgcc_eh.a: stmp-dirs"
754 echo " -rm -f ${dir}/libgcc_eh.a"
755 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a '$(objects)'
756 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
757 echo "all: $libgcc_eh_a"
761 if [ "$libgcc_s_so" ]; then
763 echo "$libgcc_s_so: stmp-dirs $libunwind_so"
764 echo " $SHLIB_LINK" \
765 | sed -e "s%@multilib_flags@%$flags%g" \
766 -e "s%@multilib_dir@%$dir%g" \
767 -e "s%@shlib_objs@%\$(objects)%g" \
768 -e "s%@shlib_base_name@%libgcc_s%g" \
769 -e "s%@shlib_map_file@%$mapfile%g" \
770 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
771 echo "all: $libgcc_s_so"
774 if [ "$libunwind_so" ]; then
776 echo "$libunwind_so: stmp-dirs"
777 echo " $SHLIBUNWIND_LINK" \
778 | sed -e "s%@multilib_flags@%$flags%g" \
779 -e "s%@multilib_dir@%$dir%g" \
780 -e "s%@shlib_objs@%\$(objects)%g" \
781 -e "s%@shlib_base_name@%libunwind%g" \
782 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
783 echo "all: $libunwind_so"
786 done # ml in MULTILIBS
789 echo "libgcc-stage-start:"
790 echo " for dir in \$(dirs); do \\"
791 echo " if [ -d \$(stage)/\$\$dir ]; then :; \\"
792 echo " else $mkinstalldirs \$(stage)/\$\$dir; fi; \\"
794 echo " -for dir in \$(dirs); do \\"
795 echo " mv \$\$dir/*${objext} \$(stage)/\$\$dir; \\"
796 echo " mv \$\$dir/*.vis \$(stage)/\$\$dir; \\"
797 echo " mv \$\$dir/*.map \$(stage)/\$\$dir; \\"
798 echo " test ! -f \$\$dir/libgcc.a || mv \$\$dir/lib* \$(stage)/\$\$dir; \\"
803 echo " for d in \$(dirs); do \\"
804 echo " if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
806 echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
808 if [ "$need_eh_dummy" ]; then
810 echo " echo 'int __libgcc_eh_dummy;' > \$@"
815 for ml in $MULTILIBS; do
816 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
817 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
818 if [ $dir != . ]; then
819 ldir='$(DESTDIR)$(libsubdir)'/$dir
820 echo " if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
822 ldir='$(DESTDIR)$(libsubdir)'
824 echo ' $(INSTALL_DATA)' ${dir}/libgcc.a ${ldir}/
825 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
826 echo ' $(INSTALL_DATA)' ${dir}/libgcov.a ${ldir}/
827 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
829 if [ "$SHLIB_LINK" ]; then
830 echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a ${ldir}/
831 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
834 os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
835 if [ "$os_multilib_dir" != . ]; then
836 shlib_slibdir_qual="/$os_multilib_dir"
838 echo " $SHLIB_INSTALL" \
839 | sed -e "s%@multilib_dir@%$dir%g" \
840 -e "s%@shlib_base_name@%libgcc_s%g" \
841 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
842 if [ "$LIBUNWIND" ]; then
843 echo " $SHLIBUNWIND_INSTALL" \
844 | sed -e "s%@multilib_dir@%$dir%g" \
845 -e "s%@shlib_base_name@%libunwind%g" \
846 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
847 libunwinddir='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
848 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a ${libunwinddir}/
849 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
853 for f in $EXTRA_MULTILIB_PARTS; do
854 for ml in $MULTILIBS; do
855 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
856 if [ $dir != . ]; then
858 ldir='$(DESTDIR)$(libsubdir)'/$dir
861 ldir='$(DESTDIR)$(libsubdir)'
863 echo ' $(INSTALL_DATA)' $out $ldir/
867 echo '.PHONY: all install'