2 # Construct makefile for libgcc.
3 # Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006
4 # Free Software Foundation, Inc.
6 # This file is part of GCC.
8 # Arguments, taken from the environment, since there are a lot
9 # of them, and positional args becomes quite ugly.
40 # EXTRA_MULTILIB_PARTS
52 # Make needs VPATH to be literal.
53 echo 'srcdir = @srcdir@'
54 echo 'VPATH = @srcdir@'
56 echo 'objects = $(filter %'$objext',$^)'
58 echo '# Dependencies are accumulated as we go.'
63 # Library members defined in libgcc2.c.
64 lib2funcs
='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
65 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi
66 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
67 _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache
68 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3
69 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
70 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
71 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
72 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
73 _divxc3 _divtc3 _floatundidf _floatundisf _floatundixf _floatunditf'
75 # Disable SHLIB_LINK if shared libgcc not enabled.
76 if [ "@enable_shared@" = "no" ]; then
82 gcc_compile
='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
83 gcc_s_compile
="$gcc_compile -DSHARED"
84 make_compile
='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
85 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
86 AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
87 AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
88 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
89 CC="$(CC)" CFLAGS="$(CFLAGS)" \
90 BUILD_PREFIX="$(BUILD_PREFIX)" \
91 BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \
92 LANGUAGES="$(LANGUAGES)"'
94 # Generic dependencies for libgcc
95 libgcc_dep
='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'
97 # Dependencies for libgcc2.c
98 libgcc2_c_dep
='stmp-dirs $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h gbl-ctors.h'" $libgcc_dep"
100 # Dependencies for libgcov.c
101 libgcov_c_dep
='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"
103 # Dependencies for fp-bit.c
104 fpbit_c_dep
='stmp-dirs config.status tsystem.h'
106 # Dependencies for decnumber and friends. This is an overzealous set,
107 # but at least we can be sure to recompile if anything gets modified.
108 decnumber_dep
='stmp-dirs $(srcdir)/../libdecnumber/decContext.h $(srcdir)/../libdecnumber/decNumber.h
109 $(srcdir)/../libdecnumber/decNumberLocal.h $(srcdir)/../libdecnumber/decimal32.h $(srcdir)/../libdecnumber/decimal64.h
110 $(srcdir)/../libdecnumber/decimal128.h $(srcdir)/../libdecnumber/decDPD.h $(srcdir)/../libdecnumber/decUtility.h'
112 # Flag whether we need eh_dummy.c
115 if [ "$SHLIB_LINK" ]; then
116 # Test -fvisibility=hidden. We need both a -fvisibility=hidden on
117 # the command line, and a #define to prevent libgcc2.h etc from
118 # overriding that with #pragmas. The dance with @ is to prevent
119 # echo from seeing anything it might take for an option.
120 # echo turns the \$\$\$\$ into $$$$ and when make sees it it
121 # becomes $$ and the shell substitutes the pid. Makes for a
122 # slightly safer temp file.
123 echo "vis_hide := \$(strip \$(subst @,-,\\"
124 echo " \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
125 echo " $gcc_compile -fvisibility=hidden -Werror \\"
126 echo " -c -xc - -o vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
127 echo " then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
128 echo " rm vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
132 # If we have -fvisibility=hidden, then we need to generate hide
133 # lists for object files implemented in assembly. The default
134 # pseudo-op for this is ".hidden", but can be overridden with
136 [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP
=".hidden"
138 echo "ifneq (,\$(vis_hide))"
139 echo "define gen-hide-list"
140 echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
141 # non-GNU nm emits three fields even for undefined and typeless symbols,
142 # so explicitly omit them
143 echo " \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
144 echo "mv -f \$@T \$@"
147 echo "gen-hide-list = echo > \$@"
151 # It is too hard to guarantee that vis_hide and gen-hide-list will never
152 # be referenced if SHLIB_LINK is not set, so set them to the values they'd
153 # have if SHLIB_LINK were set and we didn't have visibility support.
155 echo "gen-hide-list = echo > \$@"
158 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
159 # defined as optimized assembly code in LIB1ASMFUNCS.
160 for name
in $LIB1ASMFUNCS; do
161 lib2funcs
=`echo $lib2funcs | sed -e 's/^'$name' //' \
162 -e 's/ '$name' / /' \
164 LIB2_DIVMOD_FUNCS
=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
165 -e 's/ '$name' / /' \
170 # Rules to generate object files.
173 for ml
in $MULTILIBS; do
175 # Work out relevant parameters that depend only on the multilib.
176 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
177 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
179 libgcc_a
=$dir/libgcc.a
180 libgcov_a
=$dir/libgcov.a
186 if [ "$LIBUNWIND" ]; then
187 libunwind_a
=$dir/libunwind.a
189 if [ "$SHLIB_LINK" ]; then
190 libgcc_eh_a
=$dir/libgcc_eh.a
191 libgcc_s_so
=$dir/libgcc_s
${SHLIB_EXT}
192 if [ "$LIBUNWIND" ]; then
193 libunwind_so
=$dir/libunwind
${SHLIB_EXT}
195 os_multilib_dir
=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
196 if [ "$os_multilib_dir" != .
]; then
197 shlib_slibdir_qual
="/$os_multilib_dir"
208 echo \
# flags: $flags
209 echo \
# libgcc_a: $libgcc_a
210 echo \
# libgcov_a: $libgcov_a
211 echo \
# libgcc_eh_a: $libgcc_eh_a
212 echo \
# libunwind_a: $libunwind_a
214 echo \
# shlib_slibdir_qual: $shlib_slibdir_qual
215 echo \
# libgcc_s_so: $libgcc_s_so
216 echo \
# libunwind_so: $libunwind_so
220 # Update list of directories.
221 if [ $dir != .
]; then
222 echo "dirs += ${dir} libgcc/${dir}"
227 # Build libgcc1 components.
229 for name
in $LIB1ASMFUNCS; do
230 if [ "$libgcc_s_so" ]; then
231 out
="libgcc/${dir}/${name}${objext}"
232 outS
="libgcc/${dir}/${name}_s${objext}"
233 outV
="libgcc/${dir}/${name}.vis"
235 echo ${outS}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
236 echo " $gcc_s_compile" $flags -DL$name -xassembler-with-cpp \
237 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $outS
239 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)' ${outV}
240 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
241 -c '$(srcdir)/config/$(LIB1ASMSRC)' -include $outV -o $out
243 echo "${outV}: ${outS}; \$(gen-hide-list)"
246 echo $libgcc_s_so: $outS
247 if [ "$SHLIB_MKMAP" ]; then
248 echo libgcc
/${dir}/libgcc.map
: $outS
251 out
="libgcc/${dir}/${name}${objext}"
252 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
253 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
254 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
260 # Build libgcc2 components.
263 for name
in $lib2funcs; do
264 if [ "$libgcc_s_so" ]; then
265 out
="libgcc/${dir}/${name}${objext}"
266 outS
="libgcc/${dir}/${name}_s${objext}"
268 echo $outS: $libgcc2_c_dep
269 echo " $gcc_s_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' \
272 echo $out: $libgcc2_c_dep
273 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
274 -c '$(srcdir)/libgcc2.c' -o $out
277 echo $libgcc_s_so: $outS
278 if [ "$SHLIB_MKMAP" ]; then
279 echo libgcc
/${dir}/libgcc.map
: $outS
282 out
="libgcc/${dir}/${name}${objext}"
283 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
284 echo " $gcc_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $out
289 for name
in $LIB2FUNCS_ST; do
290 out
="libgcc/${dir}/${name}${objext}"
292 echo $out: $libgcc2_c_dep
293 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
294 -c '$(srcdir)/libgcc2.c' -o $out
295 echo ${dir}/libgcc.a
: $out
298 for name
in $LIB2_DIVMOD_FUNCS; do
299 if [ "$libgcc_s_so" ]; then
300 out
="libgcc/${dir}/${name}${objext}"
301 outS
="libgcc/${dir}/${name}_s${objext}"
303 echo $outS: $libgcc2_c_dep
304 echo " $gcc_s_compile" $flags -DL$name \
305 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
307 echo $out: $libgcc2_c_dep
308 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
309 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
312 echo $libgcc_s_so: $outS
313 if [ "$SHLIB_MKMAP" ]; then
314 echo libgcc
/${dir}/libgcc.map
: $outS
317 out
="libgcc/${dir}/${name}${objext}"
318 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
319 echo " $gcc_compile" $flags -DL$name \
320 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
326 # Build software floating point functions.
329 for fpbit_var
in FPBIT DPBIT TPBIT
; do
330 fpfuncs_var
="${fpbit_var}_FUNCS"
331 eval fpbit
=\$
$fpbit_var
332 eval fpfuncs
=\$
$fpfuncs_var
334 if [ "$fpbit" ] ; then
335 for name
in $fpfuncs; do
337 # _sf_to_tf and _df_to_tf require tp-bit.c
339 _
[sd
]f_to_tf
) [ -z "$TPBIT" ] && continue;;
341 if [ "$libgcc_s_so" ]; then
342 out
="libgcc/${dir}/${name}${objext}"
343 outS
="libgcc/${dir}/${name}_s${objext}"
345 echo $outS: $fpbit $fpbit_c_dep
346 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
349 echo $out: $fpbit $fpbit_c_dep
350 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
351 '$(vis_hide)' -c $fpbit -o $out
354 echo $libgcc_s_so: $outS
355 if [ "$SHLIB_MKMAP" ]; then
356 echo libgcc
/${dir}/libgcc.map
: $outS
359 out
="libgcc/${dir}/${name}${objext}"
360 echo $out: $fpbit $fpbit_c_dep
361 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
370 if [ "@enable_decimal_float@" = "yes" -a -z "$libgcc_so" ]; then
371 # Bring in the DFP support code if D32PBIT, D64PBIT or D128PBIT are set.
372 if [ -n "$D32PBIT" -o -n "$D64PBIT" -o -n "$D128PBIT" ] ; then
373 dec_filenames
="decContext decNumber decRound decLibrary decUtility"
376 # Only bring in decimal*.c files for types we support.
377 if [ -n "$D32PBIT" ] ; then
378 dec_filenames
="$dec_filenames decimal32"
380 if [ -n "$D64PBIT" ] ; then
381 dec_filenames
="$dec_filenames decimal64"
383 if [ -n "$D128PBIT" ] ; then
384 dec_filenames
="$dec_filenames decimal128"
387 for name
in $dec_filenames ; do
388 out
="libgcc/${dir}/${name}${objext}"
389 echo $out: "\$(srcdir)/../libdecnumber/${name}.c" $decnumber_dep
390 echo " $gcc_compile" $flags -c "\$(srcdir)/../libdecnumber/${name}.c" -o $out
394 # For individual functions, loop over each variable by name.
395 for dpbit_var
in D32PBIT D64PBIT D128PBIT
; do
396 dpfuncs_var
="${dpbit_var}_FUNCS"
397 eval dpbit
=\$
$dpbit_var
398 eval dpfuncs
=\$
$dpfuncs_var
400 if [ "$dpbit" ]; then
401 for name
in $dpfuncs; do
402 out
="libgcc/${dir}/${name}${objext}"
403 echo $out: $dpbit $fpbit_c_dep
404 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
413 for file in $LIB2ADD; do
414 name
=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
415 oname
=`echo $name | sed -e 's,.*/,,'`
417 if [ "$libgcc_s_so" ]; then
418 out
="libgcc/${dir}/${oname}${objext}"
419 outS
="libgcc/${dir}/${oname}_s${objext}"
423 echo $outS: stmp-dirs
$file $libgcc_dep
424 echo " $gcc_s_compile" $flags -c $file -o $outS
426 echo $out: stmp-dirs
$file $libgcc_dep
427 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
431 outV
="libgcc/${dir}/${oname}.vis"
433 echo $outS: stmp-dirs
$file $libgcc_dep
434 echo " $gcc_s_compile" $flags -xassembler-with-cpp \
437 echo $out: stmp-dirs
$file $libgcc_dep $outV
438 echo " $gcc_compile" $flags -xassembler-with-cpp \
439 -include $outV -c $file -o $out
440 echo "${outV}: ${outS}; \$(gen-hide-list)"
444 echo "Unhandled extension: $file" >&2
450 echo $libgcc_s_so: $outS
451 if [ "$SHLIB_MKMAP" ]; then
452 echo libgcc
/${dir}/libgcc.map
: $outS
455 out
="libgcc/${dir}/${oname}${objext}"
458 echo $out: stmp-dirs
$file $libgcc_dep
459 echo " $gcc_compile" $flags -c $file -o $out
463 echo $out: stmp-dirs
$file $libgcc_dep
464 echo " $gcc_compile" $flags -xassembler-with-cpp \
469 echo "Unhandled extension: $file" >&2
479 for file in $LIB2ADD_ST; do
480 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
481 oname
=`echo $name | sed -e 's,.*/,,'`
482 out
="libgcc/${dir}/${oname}${objext}"
486 echo $out: stmp-dirs
$file $libgcc_dep
487 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
491 # We may have to compile it twice in order to establish the list
492 # of symbols to be marked hidden.
493 if [ "$libgcc_so" ]; then
494 outV
="libgcc/${dir}/${oname}.vis"
495 outT
="libgcc/${dir}/${oname}_t${objext}"
496 echo ${outT}: stmp-dirs
$file $libgcc_dep
497 echo " $gcc_compile" $flags -xassembler-with-cpp \
499 echo $out: stmp-dirs
$file $libgcc_dep $outV
500 echo " $gcc_compile" $flags -xassembler-with-cpp \
501 -include $outV -c $file -o $out
502 echo "${outV}: ${outT}; \$(gen-hide-list)"
504 echo $out: stmp-dirs
$file $libgcc_dep
505 echo " $gcc_compile" $flags -xassembler-with-cpp \
511 echo "Unhandled extension: $file" >&2
518 # If we don't have libgcc_eh.a, only LIB2ADDEH matters. If we do, only
519 # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter. (Usually all three are
522 if [ "$libgcc_eh_a" ]; then
523 for file in $LIB2ADDEHSTATIC; do
524 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
525 oname
=`echo $name | sed -e 's,.*/,,'`
526 out
="libgcc/${dir}/${oname}${objext}"
530 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
531 echo " $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
534 # We have to compile it twice in order to establish the list
535 # of symbols to be marked hidden.
536 outV
="libgcc/${dir}/${oname}.vis"
537 outT
="libgcc/${dir}/${oname}_t${objext}"
538 echo ${outT}: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
539 echo " $gcc_compile" $flags -xassembler-with-cpp \
541 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep $outV
542 echo " $gcc_compile" $flags -xassembler-with-cpp \
543 -include $outV -c $file -o $out
544 echo "${outV}: ${outT}; \$(gen-hide-list)"
546 *) echo "Unhandled extension: $file">&2; exit 1 ;;
549 echo $libgcc_eh_a: $out
552 for file in $LIB2ADDEHSHARED; do
553 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
554 oname
=`echo $name | sed -e 's,.*/,,'`
555 outS
="libgcc/${dir}/${oname}_s${objext}"
559 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
560 echo " $gcc_s_compile" $flags -fexceptions -c $file -o $outS
563 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
564 echo " $gcc_s_compile" $flags -xassembler-with-cpp -c $file -o $outS
566 *) echo "Unhandled extension: $file">&2; exit 1 ;;
569 echo $libgcc_s_so: $outS
570 if [ "$SHLIB_MKMAP" ]; then
571 echo libgcc
/${dir}/libgcc.map
: $outS
575 # If nothing went into libgcc_eh.a, create a dummy object -
576 # some linkers don't like totally empty archives.
577 if [ -z "$LIB2ADDEHSTATIC" ]; then
579 out
="libgcc/${dir}/eh_dummy${objext}"
582 echo $out: stmp-dirs
$file
583 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
584 echo $libgcc_eh_a: $out
588 else # no libgcc_eh.a
589 for file in $LIB2ADDEH; do
590 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
591 oname
=`echo $name | sed -e 's,.*/,,'`
592 out
="libgcc/${dir}/${oname}${objext}"
596 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
597 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
600 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
601 echo " $gcc_compile" $flags -xassembler-with-cpp \
604 *) echo "Unhandled extension: $file">&2; exit 1 ;;
611 # We do _not_ handle assembly files in this context.
612 if [ "$LIBUNWIND" ]; then
613 for file in $LIBUNWIND; do
616 *) echo "Unhandled extension: $file">&2; exit 1 ;;
619 name
=`echo $file | sed -e 's/[.]c$//'`
620 oname
=`echo $name | sed -e 's,.*/,,'`
622 if [ "$libunwind_so" ]; then
623 out
="libgcc/${dir}/${oname}${objext}"
624 outS
="libgcc/${dir}/${oname}_s${objext}"
626 echo $out: stmp-dirs
$file $LIBUNWINDDEP
627 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
629 echo $outS: stmp-dirs
$file $LIBUNWINDDEP
630 echo " $gcc_s_compile $flags -fexceptions -c $file -o $outS"
632 echo $libunwind_a: $out
633 echo $libunwind_so: $outS
635 out
="libgcc/${dir}/${oname}${objext}"
636 echo $out: stmp-dirs
$file $LIBUNWINDDEP
637 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
638 echo $libunwind_a: $out
644 # build libgcov components
646 for name
in $LIBGCOV; do
647 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
648 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
649 out
="libgcc/${dir}/${name}${objext}"
651 echo $out: $libgcov_c_dep
652 echo " $gcc_compile $flags -DL$name -c \$(srcdir)/libgcov.c -o $out"
653 echo $libgcov_a: $out
656 # EXTRA_MULTILIB_PARTS.
657 if [ -n "$EXTRA_MULTILIB_PARTS" ]; then
658 # Each of the EXTRA_MULTILIB_PARTS is built by recursive invocation
659 # of the parent Makefile. We must do this just once for each
660 # multilib, passing it all the EXTRA_MULTILIB_PARTS as
661 # simultaneous goal targets, so that rules which cannot execute
662 # simultaneously are properly serialized.
666 for f
in $EXTRA_MULTILIB_PARTS; do
669 *) out
=$dir/$f ; t
=$dir/ ;;
672 # Prevent `make' from interpreting $out as a macro assignment
673 *'$(EQ)'*) targ
="T_TARGET=$out T_TARGET" ;;
679 if [ "$dir" = .
]; then
682 suffix
=`echo $dir | sed s,/,_,g`
684 echo extra
$suffix: stmp-dirs
685 echo " $make_compile" \\
686 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
687 echo ' MULTILIB_CFLAGS="'$flags'"' T
=$t $extra
688 echo "all: extra$suffix"
690 # Make libunwind.so and libgcc_s.so depend on these, since they
691 # are likely to be implicitly used by the link process.
692 if [ "$libgcc_s_so" ]; then
693 echo "$libgcc_s_so: extra$suffix"
695 if [ "$libunwind_so" ]; then
696 echo "$libunwind_so: extra$suffix"
700 # Library build rules.
701 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
702 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
704 # Map-file generation.
705 if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
706 mapfile
="libgcc/${dir}/libgcc.map"
707 tmpmapfile
="libgcc/${dir}/tmp-libgcc.map"
708 # This uses a here document instead of echos because some shells
709 # will convert the \1 in the second sed command to a control-A.
710 # The behavior of here documents is more predictable.
713 ${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES
714 { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS \$(objects); echo %%; \\
715 cat $SHLIB_MAPFILES \\
716 | sed -e '/^[ ]*#/d' \\
717 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
718 | $gcc_compile $flags -E -xassembler-with-cpp -; \\
719 } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
721 $libgcc_s_so: ${mapfile}
727 # Each of these .a files depends on stmp-dirs. It would seem that
728 # this dependency is redundant, since each of the object files
729 # itself depends on stmp-dirs. However, it is possible that there
730 # are in fact no object files. In that case, the stmp-dirs
731 # dependency is required; the directory containing the archive must
732 # exist before the archive itself can be created.
734 echo "$libgcc_a: stmp-dirs"
735 echo " -rm -f $libgcc_a"
736 echo ' $(AR_CREATE_FOR_TARGET)' $libgcc_a '$(objects)'
737 echo ' $(RANLIB_FOR_TARGET)' $libgcc_a
738 echo "all: $libgcc_a"
741 echo "$libgcov_a: stmp-dirs"
742 echo " -rm -f $libgcov_a"
743 echo ' $(AR_CREATE_FOR_TARGET)' $libgcov_a '$(objects)'
744 echo ' $(RANLIB_FOR_TARGET)' $libgcov_a
745 echo "all: $libgcov_a"
747 # These libraries are not always built.
748 if [ "$libunwind_a" ]; then
750 echo "$libunwind_a: stmp-dirs"
751 echo " -rm -f $libunwind_a"
752 echo ' $(AR_CREATE_FOR_TARGET)' $libunwind_a '$(objects)'
753 echo ' $(RANLIB_FOR_TARGET)' $libunwind_a
754 echo "all: $libunwind_a"
757 if [ "$libgcc_eh_a" ]; then
759 echo "${dir}/libgcc_eh.a: stmp-dirs"
760 echo " -rm -f ${dir}/libgcc_eh.a"
761 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a
'$(objects)'
762 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
763 echo "all: $libgcc_eh_a"
767 if [ "$libgcc_s_so" ]; then
769 echo "$libgcc_s_so: stmp-dirs $libunwind_so"
770 echo " $SHLIB_LINK" \
771 |
sed -e "s%@multilib_flags@%$flags%g" \
772 -e "s%@multilib_dir@%$dir%g" \
773 -e "s%@shlib_objs@%\$(objects)%g" \
774 -e "s%@shlib_base_name@%libgcc_s%g" \
775 -e "s%@shlib_map_file@%$mapfile%g" \
776 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
777 echo "all: $libgcc_s_so"
780 if [ "$libunwind_so" ]; then
782 echo "$libunwind_so: stmp-dirs"
783 echo " $SHLIBUNWIND_LINK" \
784 |
sed -e "s%@multilib_flags@%$flags%g" \
785 -e "s%@multilib_dir@%$dir%g" \
786 -e "s%@shlib_objs@%\$(objects)%g" \
787 -e "s%@shlib_base_name@%libunwind%g" \
788 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
789 echo "all: $libunwind_so"
792 done # ml in MULTILIBS
795 echo "libgcc-stage-start:"
796 echo " for dir in \$(dirs); do \\"
797 echo " if [ -d \$(stage)/\$\$dir ]; then :; \\"
798 echo " else $mkinstalldirs \$(stage)/\$\$dir; fi; \\"
800 echo " -for dir in \$(dirs); do \\"
801 echo " mv \$\$dir/*${objext} \$(stage)/\$\$dir; \\"
802 echo " mv \$\$dir/*.vis \$(stage)/\$\$dir; \\"
803 echo " mv \$\$dir/*.map \$(stage)/\$\$dir; \\"
804 echo " test ! -f \$\$dir/libgcc.a || mv \$\$dir/lib* \$(stage)/\$\$dir; \\"
809 echo " for d in \$(dirs); do \\"
810 echo " if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
812 echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
814 if [ "$need_eh_dummy" ]; then
816 echo " echo 'int __libgcc_eh_dummy;' > \$@"
821 for ml
in $MULTILIBS; do
822 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
823 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
824 if [ $dir != .
]; then
825 ldir
='$(DESTDIR)$(libsubdir)'/$dir
826 echo " if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
828 ldir
='$(DESTDIR)$(libsubdir)'
830 echo ' $(INSTALL_DATA)' ${dir}/libgcc.a
${ldir}/
831 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
832 echo ' $(INSTALL_DATA)' ${dir}/libgcov.a
${ldir}/
833 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
835 if [ "$SHLIB_LINK" ]; then
836 echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a
${ldir}/
837 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
840 os_multilib_dir
=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
841 if [ "$os_multilib_dir" != .
]; then
842 shlib_slibdir_qual
="/$os_multilib_dir"
844 echo " $SHLIB_INSTALL" \
845 |
sed -e "s%@multilib_dir@%$dir%g" \
846 -e "s%@shlib_base_name@%libgcc_s%g" \
847 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
848 if [ "$LIBUNWIND" ]; then
849 echo " $SHLIBUNWIND_INSTALL" \
850 |
sed -e "s%@multilib_dir@%$dir%g" \
851 -e "s%@shlib_base_name@%libunwind%g" \
852 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
853 libunwinddir
='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
854 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a
${libunwinddir}/
855 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
859 for f
in $EXTRA_MULTILIB_PARTS; do
860 for ml
in $MULTILIBS; do
861 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
862 if [ $dir != .
]; then
864 ldir
='$(DESTDIR)$(libsubdir)'/$dir
867 ldir
='$(DESTDIR)$(libsubdir)'
869 echo ' $(INSTALL_DATA)' $out $ldir/
873 echo '.PHONY: all install'