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
45 # Make needs VPATH to be literal.
46 echo 'srcdir = @srcdir@'
47 echo 'VPATH = @srcdir@'
49 echo 'objects = $(filter %'$objext',$^)'
51 echo '# Dependencies are accumulated as we go.'
56 # Library members defined in libgcc2.c.
57 lib2funcs
='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
58 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi
59 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
60 _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache
61 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3
62 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
63 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
64 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
65 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
66 _divxc3 _divtc3 _floatundidf _floatundisf _floatundixf _floatunditf'
68 # Disable SHLIB_LINK if shared libgcc not enabled.
69 if [ "@enable_shared@" = "no" ]; then
75 gcc_compile
='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
76 gcc_s_compile
="$gcc_compile -DSHARED"
77 make_compile
='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
78 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
79 AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
80 AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
81 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
82 CC="$(CC)" CFLAGS="$(CFLAGS)" \
83 BUILD_PREFIX="$(BUILD_PREFIX)" \
84 BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \
85 LANGUAGES="$(LANGUAGES)"'
87 # Generic dependencies for libgcc
88 libgcc_dep
='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'
90 # Dependencies for libgcc2.c
91 libgcc2_c_dep
='stmp-dirs $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h gbl-ctors.h'" $libgcc_dep"
93 # Dependencies for libgcov.c
94 libgcov_c_dep
='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"
96 # Dependencies for fp-bit.c
97 fpbit_c_dep
='stmp-dirs config.status tsystem.h'
99 # Flag whether we need eh_dummy.c
102 if [ "$SHLIB_LINK" ]; then
103 # Test -fvisibility=hidden. We need both a -fvisibility=hidden on
104 # the command line, and a #define to prevent libgcc2.h etc from
105 # overriding that with #pragmas. The dance with @ is to prevent
106 # echo from seeing anything it might take for an option.
107 # echo turns the \$\$\$\$ into $$$$ and when make sees it it
108 # becomes $$ and the shell substitutes the pid. Makes for a
109 # slightly safer temp file.
110 echo "vis_hide := \$(strip \$(subst @,-,\\"
111 echo " \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
112 echo " $gcc_compile -fvisibility=hidden -Werror \\"
113 echo " -c -xc - -o vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
114 echo " then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
115 echo " rm vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
119 # If we have -fvisibility=hidden, then we need to generate hide
120 # lists for object files implemented in assembly. The default
121 # pseudo-op for this is ".hidden", but can be overridden with
123 [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP
=".hidden"
125 echo "ifneq (,\$(vis_hide))"
126 echo "define gen-hide-list"
127 echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
128 # non-GNU nm emits three fields even for undefined and typeless symbols,
129 # so explicitly omit them
130 echo " \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
131 echo "mv -f \$@T \$@"
134 echo "gen-hide-list = echo > \$@"
138 # It is too hard to guarantee that vis_hide and gen-hide-list will never
139 # be referenced if SHLIB_LINK is not set, so set them to the values they'd
140 # have if SHLIB_LINK were set and we didn't have visibility support.
142 echo "gen-hide-list = echo > \$@"
145 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
146 # defined as optimized assembly code in LIB1ASMFUNCS.
147 for name
in $LIB1ASMFUNCS; do
148 lib2funcs
=`echo $lib2funcs | sed -e 's/^'$name' //' \
149 -e 's/ '$name' / /' \
151 LIB2_DIVMOD_FUNCS
=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
152 -e 's/ '$name' / /' \
157 # Rules to generate object files.
160 for ml
in $MULTILIBS; do
162 # Work out relevant parameters that depend only on the multilib.
163 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
164 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
166 libgcc_a
=$dir/libgcc.a
167 libgcov_a
=$dir/libgcov.a
173 if [ "$LIBUNWIND" ]; then
174 libunwind_a
=$dir/libunwind.a
176 if [ "$SHLIB_LINK" ]; then
177 libgcc_eh_a
=$dir/libgcc_eh.a
178 libgcc_s_so
=$dir/libgcc_s
${SHLIB_EXT}
179 if [ "$LIBUNWIND" ]; then
180 libunwind_so
=$dir/libunwind
${SHLIB_EXT}
182 os_multilib_dir
=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
183 if [ "$os_multilib_dir" != .
]; then
184 shlib_slibdir_qual
="/$os_multilib_dir"
195 echo \
# flags: $flags
196 echo \
# libgcc_a: $libgcc_a
197 echo \
# libgcov_a: $libgcov_a
198 echo \
# libgcc_eh_a: $libgcc_eh_a
199 echo \
# libunwind_a: $libunwind_a
201 echo \
# shlib_slibdir_qual: $shlib_slibdir_qual
202 echo \
# libgcc_s_so: $libgcc_s_so
203 echo \
# libunwind_so: $libunwind_so
207 # Update list of directories.
208 if [ $dir != .
]; then
209 echo "dirs += ${dir} libgcc/${dir}"
214 # Build libgcc1 components.
216 for name
in $LIB1ASMFUNCS; do
217 if [ "$libgcc_s_so" ]; then
218 out
="libgcc/${dir}/${name}${objext}"
219 outS
="libgcc/${dir}/${name}_s${objext}"
220 outV
="libgcc/${dir}/${name}.vis"
222 echo ${outS}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
223 echo " $gcc_s_compile" $flags -DL$name -xassembler-with-cpp \
224 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $outS
226 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)' ${outV}
227 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
228 -c '$(srcdir)/config/$(LIB1ASMSRC)' -include $outV -o $out
230 echo "${outV}: ${outS}; \$(gen-hide-list)"
233 echo $libgcc_s_so: $outS
234 if [ "$SHLIB_MKMAP" ]; then
235 echo libgcc
/${dir}/libgcc.map
: $outS
238 out
="libgcc/${dir}/${name}${objext}"
239 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
240 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
241 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
247 # Build libgcc2 components.
250 for name
in $lib2funcs; do
251 if [ "$libgcc_s_so" ]; then
252 out
="libgcc/${dir}/${name}${objext}"
253 outS
="libgcc/${dir}/${name}_s${objext}"
255 echo $outS: $libgcc2_c_dep
256 echo " $gcc_s_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' \
259 echo $out: $libgcc2_c_dep
260 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
261 -c '$(srcdir)/libgcc2.c' -o $out
264 echo $libgcc_s_so: $outS
265 if [ "$SHLIB_MKMAP" ]; then
266 echo libgcc
/${dir}/libgcc.map
: $outS
269 out
="libgcc/${dir}/${name}${objext}"
270 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
271 echo " $gcc_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $out
276 for name
in $LIB2FUNCS_ST; do
277 out
="libgcc/${dir}/${name}${objext}"
279 echo $out: $libgcc2_c_dep
280 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
281 -c '$(srcdir)/libgcc2.c' -o $out
282 echo ${dir}/libgcc.a
: $out
285 for name
in $LIB2_DIVMOD_FUNCS; do
286 if [ "$libgcc_s_so" ]; then
287 out
="libgcc/${dir}/${name}${objext}"
288 outS
="libgcc/${dir}/${name}_s${objext}"
290 echo $outS: $libgcc2_c_dep
291 echo " $gcc_s_compile" $flags -DL$name \
292 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
294 echo $out: $libgcc2_c_dep
295 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
296 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
299 echo $libgcc_s_so: $outS
300 if [ "$SHLIB_MKMAP" ]; then
301 echo libgcc
/${dir}/libgcc.map
: $outS
304 out
="libgcc/${dir}/${name}${objext}"
305 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
306 echo " $gcc_compile" $flags -DL$name \
307 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
313 # Build software floating point functions.
316 if [ "$FPBIT" ]; then
317 for name
in $FPBIT_FUNCS; do
318 if [ "$libgcc_s_so" ]; then
319 out
="libgcc/${dir}/${name}${objext}"
320 outS
="libgcc/${dir}/${name}_s${objext}"
322 echo $outS: $FPBIT $fpbit_c_dep
323 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
326 echo $out: $FPBIT $fpbit_c_dep
327 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
328 '$(vis_hide)' -c $FPBIT -o $out
331 echo $libgcc_s_so: $outS
332 if [ "$SHLIB_MKMAP" ]; then
333 echo libgcc
/${dir}/libgcc.map
: $outS
336 out
="libgcc/${dir}/${name}${objext}"
337 echo $out: $FPBIT $fpbit_c_dep
338 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
346 if [ "$DPBIT" ]; then
347 for name
in $DPBIT_FUNCS; do
348 if [ "$libgcc_s_so" ]; then
349 out
="libgcc/${dir}/${name}${objext}"
350 outS
="libgcc/${dir}/${name}_s${objext}"
352 echo $outS: $DPBIT $fpbit_c_dep
353 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
356 echo $out: $DPBIT $fpbit_c_dep
357 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
358 '$(vis_hide)' -c $DPBIT -o $out
361 echo $libgcc_s_so: $outS
362 if [ "$SHLIB_MKMAP" ]; then
363 echo libgcc
/${dir}/libgcc.map
: $outS
366 out
="libgcc/${dir}/${name}${objext}"
367 echo $out: $DPBIT $fpbit_c_dep
368 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
376 if [ "$TPBIT" ]; then
377 for name
in $TPBIT_FUNCS; do
378 if [ "$libgcc_s_so" ]; then
379 out
="libgcc/${dir}/${name}${objext}"
380 outS
="libgcc/${dir}/${name}_s${objext}"
382 echo $outS: $TPBIT $fpbit_c_dep
383 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
386 echo $out: $TPBIT $fpbit_c_dep
387 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
388 '$(vis_hide)' -c $TPBIT -o $out
391 echo $libgcc_s_so: $outS
392 if [ "$SHLIB_MKMAP" ]; then
393 echo libgcc
/${dir}/libgcc.map
: $outS
396 out
="libgcc/${dir}/${name}${objext}"
397 echo $out: $TPBIT $fpbit_c_dep
398 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
406 for file in $LIB2ADD; do
407 name
=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
408 oname
=`echo $name | sed -e 's,.*/,,'`
410 if [ "$libgcc_s_so" ]; then
411 out
="libgcc/${dir}/${oname}${objext}"
412 outS
="libgcc/${dir}/${oname}_s${objext}"
416 echo $outS: stmp-dirs
$file $libgcc_dep
417 echo " $gcc_s_compile" $flags -c $file -o $outS
419 echo $out: stmp-dirs
$file $libgcc_dep
420 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
424 outV
="libgcc/${dir}/${oname}.vis"
426 echo $outS: stmp-dirs
$file $libgcc_dep
427 echo " $gcc_s_compile" $flags -xassembler-with-cpp \
430 echo $out: stmp-dirs
$file $libgcc_dep $outV
431 echo " $gcc_compile" $flags -xassembler-with-cpp \
432 -include $outV -c $file -o $out
433 echo "${outV}: ${outS}; \$(gen-hide-list)"
437 echo "Unhandled extension: $file" >&2
443 echo $libgcc_s_so: $outS
444 if [ "$SHLIB_MKMAP" ]; then
445 echo libgcc
/${dir}/libgcc.map
: $outS
448 out
="libgcc/${dir}/${oname}${objext}"
451 echo $out: stmp-dirs
$file $libgcc_dep
452 echo " $gcc_compile" $flags -c $file -o $out
456 echo $out: stmp-dirs
$file $libgcc_dep
457 echo " $gcc_compile" $flags -xassembler-with-cpp \
462 echo "Unhandled extension: $file" >&2
472 for file in $LIB2ADD_ST; do
473 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
474 oname
=`echo $name | sed -e 's,.*/,,'`
475 out
="libgcc/${dir}/${oname}${objext}"
479 echo $out: stmp-dirs
$file $libgcc_dep
480 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
484 # We may have to compile it twice in order to establish the list
485 # of symbols to be marked hidden.
486 if [ "$libgcc_so" ]; then
487 outV
="libgcc/${dir}/${oname}.vis"
488 outT
="libgcc/${dir}/${oname}_t${objext}"
489 echo ${outT}: stmp-dirs
$file $libgcc_dep
490 echo " $gcc_compile" $flags -xassembler-with-cpp \
492 echo $out: stmp-dirs
$file $libgcc_dep $outV
493 echo " $gcc_compile" $flags -xassembler-with-cpp \
494 -include $outV -c $file -o $out
495 echo "${outV}: ${outT}; \$(gen-hide-list)"
497 echo $out: stmp-dirs
$file $libgcc_dep
498 echo " $gcc_compile" $flags -xassembler-with-cpp \
504 echo "Unhandled extension: $file" >&2
511 # If we don't have libgcc_eh.a, only LIB2ADDEH matters. If we do, only
512 # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter. (Usually all three are
515 if [ "$libgcc_eh_a" ]; then
516 for file in $LIB2ADDEHSTATIC; do
517 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
518 oname
=`echo $name | sed -e 's,.*/,,'`
519 out
="libgcc/${dir}/${oname}${objext}"
523 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
524 echo " $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
527 # We have to compile it twice in order to establish the list
528 # of symbols to be marked hidden.
529 outV
="libgcc/${dir}/${oname}.vis"
530 outT
="libgcc/${dir}/${oname}_t${objext}"
531 echo ${outT}: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
532 echo " $gcc_compile" $flags -xassembler-with-cpp \
534 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep $outV
535 echo " $gcc_compile" $flags -xassembler-with-cpp \
536 -include $outV -c $file -o $out
537 echo "${outV}: ${outT}; \$(gen-hide-list)"
539 *) echo "Unhandled extension: $file">&2; exit 1 ;;
542 echo $libgcc_eh_a: $out
545 for file in $LIB2ADDEHSHARED; do
546 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
547 oname
=`echo $name | sed -e 's,.*/,,'`
548 outS
="libgcc/${dir}/${oname}_s${objext}"
552 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
553 echo " $gcc_s_compile" $flags -fexceptions -c $file -o $outS
556 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
557 echo " $gcc_s_compile" $flags -xassembler-with-cpp -c $file -o $outS
559 *) echo "Unhandled extension: $file">&2; exit 1 ;;
562 echo $libgcc_s_so: $outS
563 if [ "$SHLIB_MKMAP" ]; then
564 echo libgcc
/${dir}/libgcc.map
: $outS
568 # If nothing went into libgcc_eh.a, create a dummy object -
569 # some linkers don't like totally empty archives.
570 if [ -z "$LIB2ADDEHSTATIC" ]; then
572 out
="libgcc/${dir}/eh_dummy${objext}"
575 echo $out: stmp-dirs
$file
576 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
577 echo $libgcc_eh_a: $out
581 else # no libgcc_eh.a
582 for file in $LIB2ADDEH; do
583 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
584 oname
=`echo $name | sed -e 's,.*/,,'`
585 out
="libgcc/${dir}/${oname}${objext}"
589 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
590 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
593 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
594 echo " $gcc_compile" $flags -xassembler-with-cpp \
597 *) echo "Unhandled extension: $file">&2; exit 1 ;;
604 # We do _not_ handle assembly files in this context.
605 if [ "$LIBUNWIND" ]; then
606 for file in $LIBUNWIND; do
609 *) echo "Unhandled extension: $file">&2; exit 1 ;;
612 name
=`echo $file | sed -e 's/[.]c$//'`
613 oname
=`echo $name | sed -e 's,.*/,,'`
615 if [ "$libunwind_so" ]; then
616 out
="libgcc/${dir}/${oname}${objext}"
617 outS
="libgcc/${dir}/${oname}_s${objext}"
619 echo $out: stmp-dirs
$file $LIBUNWINDDEP
620 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
622 echo $outS: stmp-dirs
$file $LIBUNWINDDEP
623 echo " $gcc_s_compile $flags -fexceptions -c $file -o $outS"
625 echo $libunwind_a: $out
626 echo $libunwind_so: $outS
628 out
="libgcc/${dir}/${oname}${objext}"
629 echo $out: stmp-dirs
$file $LIBUNWINDDEP
630 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
631 echo $libunwind_a: $out
637 # build libgcov components
639 for name
in $LIBGCOV; do
640 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
641 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
642 out
="libgcc/${dir}/${name}${objext}"
644 echo $out: $libgcov_c_dep
645 echo " $gcc_compile $flags -DL$name -c \$(srcdir)/libgcov.c -o $out"
646 echo $libgcov_a: $out
649 # EXTRA_MULTILIB_PARTS.
650 if [ -n "$EXTRA_MULTILIB_PARTS" ]; then
651 # Each of the EXTRA_MULTILIB_PARTS is built by recursive invocation
652 # of the parent Makefile. We must do this just once for each
653 # multilib, passing it all the EXTRA_MULTILIB_PARTS as
654 # simultaneous goal targets, so that rules which cannot execute
655 # simultaneously are properly serialized.
659 for f
in $EXTRA_MULTILIB_PARTS; do
662 *) out
=$dir/$f ; t
=$dir/ ;;
665 # Prevent `make' from interpreting $out as a macro assignment
666 *'$(EQ)'*) targ
="T_TARGET=$out T_TARGET" ;;
672 if [ "$dir" = .
]; then
675 suffix
=`echo $dir | sed s,/,_,g`
677 echo extra
$suffix: stmp-dirs
678 echo " $make_compile" \\
679 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
680 echo ' MULTILIB_CFLAGS="'$flags'"' T
=$t $extra
681 echo "all: extra$suffix"
683 # Make libunwind.so and libgcc_s.so depend on these, since they
684 # are likely to be implicitly used by the link process.
685 if [ "$libgcc_s_so" ]; then
686 echo "$libgcc_s_so: extra$suffix"
688 if [ "$libunwind_so" ]; then
689 echo "$libunwind_so: extra$suffix"
693 # Library build rules.
694 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
695 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
697 # Map-file generation.
698 if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
699 mapfile
="libgcc/${dir}/libgcc.map"
700 tmpmapfile
="libgcc/${dir}/tmp-libgcc.map"
701 # This uses a here document instead of echos because some shells
702 # will convert the \1 in the second sed command to a control-A.
703 # The behavior of here documents is more predictable.
706 ${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES
707 { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS \$(objects); echo %%; \\
708 cat $SHLIB_MAPFILES \\
709 | sed -e '/^[ ]*#/d' \\
710 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
711 | $gcc_compile $flags -E -xassembler-with-cpp -; \\
712 } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
714 $libgcc_s_so: ${mapfile}
720 # Each of these .a files depends on stmp-dirs. It would seem that
721 # this dependency is redundant, since each of the object files
722 # itself depends on stmp-dirs. However, it is possible that there
723 # are in fact no object files. In that case, the stmp-dirs
724 # dependency is required; the directory containing the archive must
725 # exist before the archive itself can be created.
727 echo "$libgcc_a: stmp-dirs"
728 echo " -rm -f $libgcc_a"
729 echo ' $(AR_CREATE_FOR_TARGET)' $libgcc_a '$(objects)'
730 echo ' $(RANLIB_FOR_TARGET)' $libgcc_a
731 echo "all: $libgcc_a"
734 echo "$libgcov_a: stmp-dirs"
735 echo " -rm -f $libgcov_a"
736 echo ' $(AR_CREATE_FOR_TARGET)' $libgcov_a '$(objects)'
737 echo ' $(RANLIB_FOR_TARGET)' $libgcov_a
738 echo "all: $libgcov_a"
740 # These libraries are not always built.
741 if [ "$libunwind_a" ]; then
743 echo "$libunwind_a: stmp-dirs"
744 echo " -rm -f $libunwind_a"
745 echo ' $(AR_CREATE_FOR_TARGET)' $libunwind_a '$(objects)'
746 echo ' $(RANLIB_FOR_TARGET)' $libunwind_a
747 echo "all: $libunwind_a"
750 if [ "$libgcc_eh_a" ]; then
752 echo "${dir}/libgcc_eh.a: stmp-dirs"
753 echo " -rm -f ${dir}/libgcc_eh.a"
754 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a
'$(objects)'
755 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
756 echo "all: $libgcc_eh_a"
760 if [ "$libgcc_s_so" ]; then
762 echo "$libgcc_s_so: stmp-dirs $libunwind_so"
763 echo " $SHLIB_LINK" \
764 |
sed -e "s%@multilib_flags@%$flags%g" \
765 -e "s%@multilib_dir@%$dir%g" \
766 -e "s%@shlib_objs@%\$(objects)%g" \
767 -e "s%@shlib_base_name@%libgcc_s%g" \
768 -e "s%@shlib_map_file@%$mapfile%g" \
769 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
770 echo "all: $libgcc_s_so"
773 if [ "$libunwind_so" ]; then
775 echo "$libunwind_so: stmp-dirs"
776 echo " $SHLIBUNWIND_LINK" \
777 |
sed -e "s%@multilib_flags@%$flags%g" \
778 -e "s%@multilib_dir@%$dir%g" \
779 -e "s%@shlib_objs@%\$(objects)%g" \
780 -e "s%@shlib_base_name@%libunwind%g" \
781 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
782 echo "all: $libunwind_so"
785 done # ml in MULTILIBS
788 echo "libgcc-stage-start:"
789 echo " for dir in \$(dirs); do \\"
790 echo " if [ -d \$(stage)/\$\$dir ]; then :; \\"
791 echo " else $mkinstalldirs \$(stage)/\$\$dir; fi; \\"
793 echo " -for dir in \$(dirs); do \\"
794 echo " mv \$\$dir/*${objext} \$(stage)/\$\$dir; \\"
795 echo " mv \$\$dir/*.vis \$(stage)/\$\$dir; \\"
796 echo " mv \$\$dir/*.map \$(stage)/\$\$dir; \\"
797 echo " test ! -f \$\$dir/libgcc.a || mv \$\$dir/lib* \$(stage)/\$\$dir; \\"
802 echo " for d in \$(dirs); do \\"
803 echo " if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
805 echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
807 if [ "$need_eh_dummy" ]; then
809 echo " echo 'int __libgcc_eh_dummy;' > \$@"
814 for ml
in $MULTILIBS; do
815 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
816 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
817 if [ $dir != .
]; then
818 ldir
='$(DESTDIR)$(libsubdir)'/$dir
819 echo " if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
821 ldir
='$(DESTDIR)$(libsubdir)'
823 echo ' $(INSTALL_DATA)' ${dir}/libgcc.a
${ldir}/
824 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
825 echo ' $(INSTALL_DATA)' ${dir}/libgcov.a
${ldir}/
826 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
828 if [ "$SHLIB_LINK" ]; then
829 echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a
${ldir}/
830 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
833 os_multilib_dir
=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
834 if [ "$os_multilib_dir" != .
]; then
835 shlib_slibdir_qual
="/$os_multilib_dir"
837 echo " $SHLIB_INSTALL" \
838 |
sed -e "s%@multilib_dir@%$dir%g" \
839 -e "s%@shlib_base_name@%libgcc_s%g" \
840 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
841 if [ "$LIBUNWIND" ]; then
842 echo " $SHLIBUNWIND_INSTALL" \
843 |
sed -e "s%@multilib_dir@%$dir%g" \
844 -e "s%@shlib_base_name@%libunwind%g" \
845 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
846 libunwinddir
='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
847 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a
${libunwinddir}/
848 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
852 for f
in $EXTRA_MULTILIB_PARTS; do
853 for ml
in $MULTILIBS; do
854 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
855 if [ $dir != .
]; then
857 ldir
='$(DESTDIR)$(libsubdir)'/$dir
860 ldir
='$(DESTDIR)$(libsubdir)'
862 echo ' $(INSTALL_DATA)' $out $ldir/
866 echo '.PHONY: all install'