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.
29 # LIB2_SIDITI_CONV_FUNCS
44 # EXTRA_MULTILIB_PARTS
56 # Make needs VPATH to be literal.
57 echo 'srcdir = @srcdir@'
58 echo 'VPATH = @srcdir@'
60 echo 'objects = $(filter %'$objext',$^)'
62 echo '# Dependencies are accumulated as we go.'
67 # Library members defined in libgcc2.c.
69 # The floating-point conversion routines that involve a single-word integer.
70 # XX stands for the integer mode.
72 for mode
in sf df xf
; do
73 swfloatfuncs
="$swfloatfuncs _fixuns${mode}XX"
76 # Likewise double-word routines.
78 for mode
in sf df xf tf
; do
79 dwfloatfuncs
="$dwfloatfuncs _fix${mode}XX _fixuns${mode}XX"
80 dwfloatfuncs
="$dwfloatfuncs _floatXX${mode} _floatunXX${mode}"
83 # Entries of the form <objfile>:<func>:<wordsize> indicate that libgcc2.c
84 # should be compiled with L<func> defined and with LIBGCC2_UNITS_PER_WORD
85 # set to <wordsize>. <objfile> is the name of the associated object file
87 lib2funcs
='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
88 _cmpdi2 _ucmpdi2 _clear_cache
89 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3
90 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
91 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
92 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
93 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
94 _divxc3 _divtc3 _bswapsi2 _bswapdi2'
96 if [ "$LIB2_SIDITI_CONV_FUNCS" ]; then
97 for func
in $swfloatfuncs; do
98 sifunc
=`echo $func | sed -e 's/XX/si/'`
99 lib2funcs
="$lib2funcs $sifunc:$sifunc:4"
101 for func
in $dwfloatfuncs; do
102 difunc
=`echo $func | sed -e 's/XX/di/'`
103 tifunc
=`echo $func | sed -e 's/XX/ti/'`
104 lib2funcs
="$lib2funcs $difunc:$difunc:4 $tifunc:$difunc:8"
107 lib2funcs
="$lib2funcs `echo $swfloatfuncs | sed -e 's/XX/si/g'`"
108 lib2funcs
="$lib2funcs `echo $dwfloatfuncs | sed -e 's/XX/di/g'`"
111 # Disable SHLIB_LINK if shared libgcc not enabled.
112 if [ "@enable_shared@" = "no" ]; then
118 gcc_compile
='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
119 gcc_s_compile
="$gcc_compile -DSHARED"
120 make_compile
='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
121 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
122 AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
123 AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
124 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
125 CC="$(CC)" CFLAGS="$(CFLAGS)" \
126 BUILD_PREFIX="$(BUILD_PREFIX)" \
127 BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \
128 LANGUAGES="$(LANGUAGES)"'
130 # Generic dependencies for libgcc
131 libgcc_dep
='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'
133 # Dependencies for libgcc2.c
134 libgcc2_c_dep
='stmp-dirs $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h gbl-ctors.h'" $libgcc_dep"
136 # Dependencies for libgcov.c
137 libgcov_c_dep
='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"
139 # Dependencies for fp-bit.c
140 fpbit_c_dep
='stmp-dirs config.status tsystem.h'
142 # Dependencies for decnumber and friends. This is an overzealous set,
143 # but at least we can be sure to recompile if anything gets modified.
144 decnumber_dep
='stmp-dirs $(srcdir)/../libdecnumber/decContext.h $(srcdir)/../libdecnumber/decNumber.h
145 $(srcdir)/../libdecnumber/decNumberLocal.h $(srcdir)/../libdecnumber/decimal32.h $(srcdir)/../libdecnumber/decimal64.h
146 $(srcdir)/../libdecnumber/decimal128.h $(srcdir)/../libdecnumber/decDPD.h $(srcdir)/../libdecnumber/decUtility.h'
148 # Dependencies for dfp-bit.c
149 dfpbit_c_dep
='$(srcdir)/../libdecnumber/decRound.h'" $libgcc_dep $decnumber_dep"
151 # Flag whether we need eh_dummy.c
154 if [ "$SHLIB_LINK" ]; then
155 # Test -fvisibility=hidden. We need both a -fvisibility=hidden on
156 # the command line, and a #define to prevent libgcc2.h etc from
157 # overriding that with #pragmas. The dance with @ is to prevent
158 # echo from seeing anything it might take for an option.
159 # echo turns the \$\$\$\$ into $$$$ and when make sees it it
160 # becomes $$ and the shell substitutes the pid. Makes for a
161 # slightly safer temp file.
162 echo "vis_hide := \$(strip \$(subst @,-,\\"
163 echo " \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
164 echo " $gcc_compile -fvisibility=hidden -Werror \\"
165 echo " -c -xc - -o vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
166 echo " then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
167 echo " rm vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
171 # If we have -fvisibility=hidden, then we need to generate hide
172 # lists for object files implemented in assembly. The default
173 # pseudo-op for this is ".hidden", but can be overridden with
175 [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP
=".hidden"
177 echo "ifneq (,\$(vis_hide))"
178 echo "define gen-hide-list"
179 echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
180 # non-GNU nm emits three fields even for undefined and typeless symbols,
181 # so explicitly omit them
182 echo " \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
183 echo "mv -f \$@T \$@"
186 echo "gen-hide-list = echo > \$@"
190 # It is too hard to guarantee that vis_hide and gen-hide-list will never
191 # be referenced if SHLIB_LINK is not set, so set them to the values they'd
192 # have if SHLIB_LINK were set and we didn't have visibility support.
194 echo "gen-hide-list = echo > \$@"
197 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
198 # defined as optimized assembly code in LIB1ASMFUNCS or as C code
199 # in LIB2FUNCS_EXCLUDE.
200 for name
in $LIB1ASMFUNCS $LIB2FUNCS_EXCLUDE; do
201 lib2funcs
=`echo $lib2funcs | sed -e 's/^'$name'[ :]//' \
202 -e 's/ '$name'[ :]/ /' \
204 LIB2_DIVMOD_FUNCS
=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
205 -e 's/ '$name' / /' \
210 # Rules to generate object files.
213 for ml
in $MULTILIBS; do
215 # Work out relevant parameters that depend only on the multilib.
216 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
217 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
219 libgcc_a
=$dir/libgcc.a
220 libgcov_a
=$dir/libgcov.a
226 if [ "$LIBUNWIND" ]; then
227 libunwind_a
=$dir/libunwind.a
229 if [ "$SHLIB_LINK" ]; then
230 libgcc_eh_a
=$dir/libgcc_eh.a
231 libgcc_s_so
=$dir/libgcc_s
${SHLIB_EXT}
232 if [ "$LIBUNWIND" ]; then
233 libunwind_so
=$dir/libunwind
${SHLIB_EXT}
235 os_multilib_dir
=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
236 if [ "$os_multilib_dir" != .
]; then
237 shlib_slibdir_qual
="/$os_multilib_dir"
248 echo \
# flags: $flags
249 echo \
# libgcc_a: $libgcc_a
250 echo \
# libgcov_a: $libgcov_a
251 echo \
# libgcc_eh_a: $libgcc_eh_a
252 echo \
# libunwind_a: $libunwind_a
254 echo \
# shlib_slibdir_qual: $shlib_slibdir_qual
255 echo \
# libgcc_s_so: $libgcc_s_so
256 echo \
# libunwind_so: $libunwind_so
260 # Update list of directories.
261 if [ $dir != .
]; then
262 echo "dirs += ${dir} libgcc/${dir}"
267 # Build libgcc1 components.
269 for name
in $LIB1ASMFUNCS; do
270 if [ "$libgcc_s_so" ]; then
271 out
="libgcc/${dir}/${name}${objext}"
272 outS
="libgcc/${dir}/${name}_s${objext}"
273 outV
="libgcc/${dir}/${name}.vis"
275 echo ${outS}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
276 echo " $gcc_s_compile" $flags -DL$name -xassembler-with-cpp \
277 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $outS
279 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)' ${outV}
280 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
281 -c '$(srcdir)/config/$(LIB1ASMSRC)' -include $outV -o $out
283 echo "${outV}: ${outS}; \$(gen-hide-list)"
286 echo $libgcc_s_so: $outS
287 if [ "$SHLIB_MKMAP" ]; then
288 echo libgcc
/${dir}/libgcc.map
: $outS
291 out
="libgcc/${dir}/${name}${objext}"
292 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
293 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
294 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
300 # Build libgcc2 components.
303 for name
in $lib2funcs; do
306 defines
=`echo $name | sed -e 's/.*:\(.*\):\(.*\)/-DL\1 -DLIBGCC2_UNITS_PER_WORD=\2/'`
307 name
=`echo $name | sed -e 's/\(.*\):.*:.*/\1/'`
313 if [ "$libgcc_s_so" ]; then
314 out
="libgcc/${dir}/${name}${objext}"
315 outS
="libgcc/${dir}/${name}_s${objext}"
317 echo $outS: $libgcc2_c_dep
318 echo " $gcc_s_compile" $flags $defines -c '$(srcdir)/libgcc2.c' \
321 echo $out: $libgcc2_c_dep
322 echo " $gcc_compile" $flags $defines '$(vis_hide)' \
323 -c '$(srcdir)/libgcc2.c' -o $out
326 echo $libgcc_s_so: $outS
327 if [ "$SHLIB_MKMAP" ]; then
328 echo libgcc
/${dir}/libgcc.map
: $outS
331 out
="libgcc/${dir}/${name}${objext}"
332 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
333 echo " $gcc_compile" $flags $defines -c '$(srcdir)/libgcc2.c' -o $out
338 for name
in $LIB2FUNCS_ST; do
339 out
="libgcc/${dir}/${name}${objext}"
341 echo $out: $libgcc2_c_dep
342 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
343 -c '$(srcdir)/libgcc2.c' -o $out
344 echo ${dir}/libgcc.a
: $out
347 for name
in $LIB2_DIVMOD_FUNCS; do
348 if [ "$libgcc_s_so" ]; then
349 out
="libgcc/${dir}/${name}${objext}"
350 outS
="libgcc/${dir}/${name}_s${objext}"
352 echo $outS: $libgcc2_c_dep
353 echo " $gcc_s_compile" $flags -DL$name \
354 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
356 echo $out: $libgcc2_c_dep
357 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
358 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -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}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
368 echo " $gcc_compile" $flags -DL$name \
369 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
375 # Build software floating point functions.
378 for fpbit_var
in FPBIT DPBIT TPBIT
; do
379 fpfuncs_var
="${fpbit_var}_FUNCS"
380 eval fpbit
=\$
$fpbit_var
381 eval fpfuncs
=\$
$fpfuncs_var
383 if [ "$fpbit" ] ; then
384 for name
in $fpfuncs; do
386 # _sf_to_tf and _df_to_tf require tp-bit.c
388 _
[sd
]f_to_tf
) [ -z "$TPBIT" ] && continue;;
390 if [ "$libgcc_s_so" ]; then
391 out
="libgcc/${dir}/${name}${objext}"
392 outS
="libgcc/${dir}/${name}_s${objext}"
394 echo $outS: $fpbit $fpbit_c_dep
395 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
398 echo $out: $fpbit $fpbit_c_dep
399 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
400 '$(vis_hide)' -c $fpbit -o $out
403 echo $libgcc_s_so: $outS
404 if [ "$SHLIB_MKMAP" ]; then
405 echo libgcc
/${dir}/libgcc.map
: $outS
408 out
="libgcc/${dir}/${name}${objext}"
409 echo $out: $fpbit $fpbit_c_dep
410 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
419 if [ "@enable_decimal_float@" = "yes" -a -z "$libgcc_so" ]; then
420 # If $DFP_ENABLE is set, then we want all data type sizes.
421 if [ "$DFP_ENABLE" ] ; then
422 D32PBIT
=1; D64PBIT
=1; D128PBIT
=1
425 # Bring in the DFP support code if D32PBIT, D64PBIT or D128PBIT are set.
426 if [ -n "$D32PBIT" -o -n "$D64PBIT" -o -n "$D128PBIT" ] ; then
427 dec_filenames
="decContext decNumber decRound decLibrary decUtility"
430 # Only bring in decimal*.c files for types we support.
431 if [ -n "$D32PBIT" ] ; then
432 dec_filenames
="$dec_filenames decimal32"
434 if [ -n "$D64PBIT" ] ; then
435 dec_filenames
="$dec_filenames decimal64"
437 if [ -n "$D128PBIT" ] ; then
438 dec_filenames
="$dec_filenames decimal128"
441 for name
in $dec_filenames ; do
442 out
="libgcc/${dir}/${name}${objext}"
443 echo $out: "\$(srcdir)/../libdecnumber/${name}.c" $decnumber_dep
444 echo " $gcc_compile" $flags -c "\$(srcdir)/../libdecnumber/${name}.c" -o $out
448 # For individual functions, loop over each variable by name.
449 for dpbit_var
in D32PBIT D64PBIT D128PBIT
; do
450 dpfuncs_var
="${dpbit_var}_FUNCS"
451 eval dpbit
=\$
$dpbit_var
452 eval dpfuncs
=\$
$dpfuncs_var
454 D32PBIT
) dpwidth
=32 ;;
455 D64PBIT
) dpwidth
=64 ;;
456 D128PBIT
) dpwidth
=128 ;;
459 if [ "$dpbit" ]; then
460 for name
in $dpfuncs; do
461 out
="libgcc/${dir}/${name}${objext}"
462 echo $out: config
/dfp-bit.h config
/dfp-bit.c
$dfpbit_c_dep
463 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name -DWIDTH=$dpwidth \
464 $DFP_CFLAGS -c $\
(srcdir\
)/config
/dfp-bit.c
-o $out
471 for file in $LIB2ADD; do
472 name
=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
473 oname
=`echo $name | sed -e 's,.*/,,'`
475 if [ "$libgcc_s_so" ]; then
476 out
="libgcc/${dir}/${oname}${objext}"
477 outS
="libgcc/${dir}/${oname}_s${objext}"
481 echo $outS: stmp-dirs
$file $libgcc_dep
482 echo " $gcc_s_compile" $flags -c $file -o $outS
484 echo $out: stmp-dirs
$file $libgcc_dep
485 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
489 outV
="libgcc/${dir}/${oname}.vis"
491 echo $outS: stmp-dirs
$file $libgcc_dep
492 echo " $gcc_s_compile" $flags -xassembler-with-cpp \
495 echo $out: stmp-dirs
$file $libgcc_dep $outV
496 echo " $gcc_compile" $flags -xassembler-with-cpp \
497 -include $outV -c $file -o $out
498 echo "${outV}: ${outS}; \$(gen-hide-list)"
502 echo "Unhandled extension: $file" >&2
508 echo $libgcc_s_so: $outS
509 if [ "$SHLIB_MKMAP" ]; then
510 echo libgcc
/${dir}/libgcc.map
: $outS
513 out
="libgcc/${dir}/${oname}${objext}"
516 echo $out: stmp-dirs
$file $libgcc_dep
517 echo " $gcc_compile" $flags -c $file -o $out
521 echo $out: stmp-dirs
$file $libgcc_dep
522 echo " $gcc_compile" $flags -xassembler-with-cpp \
527 echo "Unhandled extension: $file" >&2
537 for file in $LIB2ADD_ST; do
538 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
539 oname
=`echo $name | sed -e 's,.*/,,'`
540 out
="libgcc/${dir}/${oname}${objext}"
544 echo $out: stmp-dirs
$file $libgcc_dep
545 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
549 # We may have to compile it twice in order to establish the list
550 # of symbols to be marked hidden.
551 if [ "$libgcc_so" ]; then
552 outV
="libgcc/${dir}/${oname}.vis"
553 outT
="libgcc/${dir}/${oname}_t${objext}"
554 echo ${outT}: stmp-dirs
$file $libgcc_dep
555 echo " $gcc_compile" $flags -xassembler-with-cpp \
557 echo $out: stmp-dirs
$file $libgcc_dep $outV
558 echo " $gcc_compile" $flags -xassembler-with-cpp \
559 -include $outV -c $file -o $out
560 echo "${outV}: ${outT}; \$(gen-hide-list)"
562 echo $out: stmp-dirs
$file $libgcc_dep
563 echo " $gcc_compile" $flags -xassembler-with-cpp \
569 echo "Unhandled extension: $file" >&2
576 # If we don't have libgcc_eh.a, only LIB2ADDEH matters. If we do, only
577 # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter. (Usually all three are
580 if [ "$libgcc_eh_a" ]; then
581 for file in $LIB2ADDEHSTATIC; do
582 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
583 oname
=`echo $name | sed -e 's,.*/,,'`
584 out
="libgcc/${dir}/${oname}${objext}"
588 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
589 echo " $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
592 # We have to compile it twice in order to establish the list
593 # of symbols to be marked hidden.
594 outV
="libgcc/${dir}/${oname}.vis"
595 outT
="libgcc/${dir}/${oname}_t${objext}"
596 echo ${outT}: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
597 echo " $gcc_compile" $flags -xassembler-with-cpp \
599 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep $outV
600 echo " $gcc_compile" $flags -xassembler-with-cpp \
601 -include $outV -c $file -o $out
602 echo "${outV}: ${outT}; \$(gen-hide-list)"
604 *) echo "Unhandled extension: $file">&2; exit 1 ;;
607 echo $libgcc_eh_a: $out
610 for file in $LIB2ADDEHSHARED; do
611 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
612 oname
=`echo $name | sed -e 's,.*/,,'`
613 outS
="libgcc/${dir}/${oname}_s${objext}"
617 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
618 echo " $gcc_s_compile" $flags -fexceptions -c $file -o $outS
621 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
622 echo " $gcc_s_compile" $flags -xassembler-with-cpp -c $file -o $outS
624 *) echo "Unhandled extension: $file">&2; exit 1 ;;
627 echo $libgcc_s_so: $outS
628 if [ "$SHLIB_MKMAP" ]; then
629 echo libgcc
/${dir}/libgcc.map
: $outS
633 # If nothing went into libgcc_eh.a, create a dummy object -
634 # some linkers don't like totally empty archives.
635 if [ -z "$LIB2ADDEHSTATIC" ]; then
637 out
="libgcc/${dir}/eh_dummy${objext}"
640 echo $out: stmp-dirs
$file
641 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
642 echo $libgcc_eh_a: $out
646 else # no libgcc_eh.a
647 for file in $LIB2ADDEH; do
648 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
649 oname
=`echo $name | sed -e 's,.*/,,'`
650 out
="libgcc/${dir}/${oname}${objext}"
654 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
655 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
658 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
659 echo " $gcc_compile" $flags -xassembler-with-cpp \
662 *) echo "Unhandled extension: $file">&2; exit 1 ;;
669 # We do _not_ handle assembly files in this context.
670 if [ "$LIBUNWIND" ]; then
671 for file in $LIBUNWIND; do
674 *) echo "Unhandled extension: $file">&2; exit 1 ;;
677 name
=`echo $file | sed -e 's/[.]c$//'`
678 oname
=`echo $name | sed -e 's,.*/,,'`
680 if [ "$libunwind_so" ]; then
681 out
="libgcc/${dir}/${oname}${objext}"
682 outS
="libgcc/${dir}/${oname}_s${objext}"
684 echo $out: stmp-dirs
$file $LIBUNWINDDEP
685 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
687 echo $outS: stmp-dirs
$file $LIBUNWINDDEP
688 echo " $gcc_s_compile $flags -fexceptions -c $file -o $outS"
690 echo $libunwind_a: $out
691 echo $libunwind_so: $outS
693 out
="libgcc/${dir}/${oname}${objext}"
694 echo $out: stmp-dirs
$file $LIBUNWINDDEP
695 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
696 echo $libunwind_a: $out
702 # build libgcov components
704 for name
in $LIBGCOV; do
705 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
706 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
707 out
="libgcc/${dir}/${name}${objext}"
709 echo $out: $libgcov_c_dep
710 echo " $gcc_compile $flags -DL$name -c \$(srcdir)/libgcov.c -o $out"
711 echo $libgcov_a: $out
714 # EXTRA_MULTILIB_PARTS.
715 if [ -n "$EXTRA_MULTILIB_PARTS" ]; then
716 # Each of the EXTRA_MULTILIB_PARTS is built by recursive invocation
717 # of the parent Makefile. We must do this just once for each
718 # multilib, passing it all the EXTRA_MULTILIB_PARTS as
719 # simultaneous goal targets, so that rules which cannot execute
720 # simultaneously are properly serialized.
724 for f
in $EXTRA_MULTILIB_PARTS; do
727 *) out
=$dir/$f ; t
=$dir/ ;;
730 # Prevent `make' from interpreting $out as a macro assignment
731 *'$(EQ)'*) targ
="T_TARGET=$out T_TARGET" ;;
737 if [ "$dir" = .
]; then
740 suffix
=`echo $dir | sed s,/,_,g`
742 echo extra
$suffix: stmp-dirs
743 echo " $make_compile" \\
744 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
745 echo ' MULTILIB_CFLAGS="'$flags'"' T
=$t $extra
746 echo "all: extra$suffix"
748 # Make libunwind.so and libgcc_s.so depend on these, since they
749 # are likely to be implicitly used by the link process.
750 if [ "$libgcc_s_so" ]; then
751 echo "$libgcc_s_so: extra$suffix"
753 if [ "$libunwind_so" ]; then
754 echo "$libunwind_so: extra$suffix"
758 # Library build rules.
759 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
760 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
762 # Map-file generation.
763 if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
764 mapfile
="libgcc/${dir}/libgcc.map"
765 tmpmapfile
="libgcc/${dir}/tmp-libgcc.map"
766 # This uses a here document instead of echos because some shells
767 # will convert the \1 in the second sed command to a control-A.
768 # The behavior of here documents is more predictable.
771 ${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES
772 { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS \$(objects); echo %%; \\
773 cat $SHLIB_MAPFILES \\
774 | sed -e '/^[ ]*#/d' \\
775 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
776 | $gcc_compile $flags -E -xassembler-with-cpp -; \\
777 } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
779 $libgcc_s_so: ${mapfile}
785 # Each of these .a files depends on stmp-dirs. It would seem that
786 # this dependency is redundant, since each of the object files
787 # itself depends on stmp-dirs. However, it is possible that there
788 # are in fact no object files. In that case, the stmp-dirs
789 # dependency is required; the directory containing the archive must
790 # exist before the archive itself can be created.
792 echo "$libgcc_a: stmp-dirs"
793 echo " -rm -f $libgcc_a"
794 echo ' $(AR_CREATE_FOR_TARGET)' $libgcc_a '$(objects)'
795 echo ' $(RANLIB_FOR_TARGET)' $libgcc_a
796 echo "all: $libgcc_a"
799 echo "$libgcov_a: stmp-dirs"
800 echo " -rm -f $libgcov_a"
801 echo ' $(AR_CREATE_FOR_TARGET)' $libgcov_a '$(objects)'
802 echo ' $(RANLIB_FOR_TARGET)' $libgcov_a
803 echo "all: $libgcov_a"
805 # These libraries are not always built.
806 if [ "$libunwind_a" ]; then
808 echo "$libunwind_a: stmp-dirs"
809 echo " -rm -f $libunwind_a"
810 echo ' $(AR_CREATE_FOR_TARGET)' $libunwind_a '$(objects)'
811 echo ' $(RANLIB_FOR_TARGET)' $libunwind_a
812 echo "all: $libunwind_a"
815 if [ "$libgcc_eh_a" ]; then
817 echo "${dir}/libgcc_eh.a: stmp-dirs"
818 echo " -rm -f ${dir}/libgcc_eh.a"
819 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a
'$(objects)'
820 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
821 echo "all: $libgcc_eh_a"
825 if [ "$libgcc_s_so" ]; then
827 echo "$libgcc_s_so: stmp-dirs $libunwind_so"
828 echo " $SHLIB_LINK" \
829 |
sed -e "s%@multilib_flags@%$flags%g" \
830 -e "s%@multilib_dir@%$dir%g" \
831 -e "s%@shlib_objs@%\$(objects)%g" \
832 -e "s%@shlib_base_name@%libgcc_s%g" \
833 -e "s%@shlib_map_file@%$mapfile%g" \
834 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
835 echo "all: $libgcc_s_so"
838 if [ "$libunwind_so" ]; then
840 echo "$libunwind_so: stmp-dirs"
841 echo " $SHLIBUNWIND_LINK" \
842 |
sed -e "s%@multilib_flags@%$flags%g" \
843 -e "s%@multilib_dir@%$dir%g" \
844 -e "s%@shlib_objs@%\$(objects)%g" \
845 -e "s%@shlib_base_name@%libunwind%g" \
846 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
847 echo "all: $libunwind_so"
850 done # ml in MULTILIBS
853 echo "libgcc-stage-start:"
854 echo " for dir in \$(dirs); do \\"
855 echo " if [ -d \$(stage)/\$\$dir ]; then :; \\"
856 echo " else $mkinstalldirs \$(stage)/\$\$dir; fi; \\"
858 echo " -for dir in \$(dirs); do \\"
859 echo " mv \$\$dir/*${objext} \$(stage)/\$\$dir; \\"
860 echo " mv \$\$dir/*.vis \$(stage)/\$\$dir; \\"
861 echo " mv \$\$dir/*.map \$(stage)/\$\$dir; \\"
862 echo " test ! -f \$\$dir/libgcc.a || mv \$\$dir/lib* \$(stage)/\$\$dir; \\"
867 echo " for d in \$(dirs); do \\"
868 echo " if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
870 echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
872 if [ "$need_eh_dummy" ]; then
874 echo " echo 'int __libgcc_eh_dummy;' > \$@"
879 for ml
in $MULTILIBS; do
880 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
881 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
882 if [ $dir != .
]; then
883 ldir
='$(DESTDIR)$(libsubdir)'/$dir
884 echo " if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
886 ldir
='$(DESTDIR)$(libsubdir)'
888 echo ' $(INSTALL_DATA)' ${dir}/libgcc.a
${ldir}/
889 echo ' chmod 644' ${ldir}/libgcc.a
890 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
891 echo ' $(INSTALL_DATA)' ${dir}/libgcov.a
${ldir}/
892 echo ' chmod 644' ${ldir}/libgcov.a
893 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
895 if [ "$SHLIB_LINK" ]; then
896 echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a
${ldir}/
897 echo ' chmod 644' ${ldir}/libgcc_eh.a
898 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
901 os_multilib_dir
=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
902 if [ "$os_multilib_dir" != .
]; then
903 shlib_slibdir_qual
="/$os_multilib_dir"
905 echo " $SHLIB_INSTALL" \
906 |
sed -e "s%@multilib_dir@%$dir%g" \
907 -e "s%@shlib_base_name@%libgcc_s%g" \
908 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
909 if [ "$LIBUNWIND" ]; then
910 echo " $SHLIBUNWIND_INSTALL" \
911 |
sed -e "s%@multilib_dir@%$dir%g" \
912 -e "s%@shlib_base_name@%libunwind%g" \
913 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
914 libunwinddir
='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
915 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a
${libunwinddir}/
916 echo ' chmod 644' ${dir}/libunwind.a
917 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
921 for f
in $EXTRA_MULTILIB_PARTS; do
922 for ml
in $MULTILIBS; do
923 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
924 if [ $dir != .
]; then
926 ldir
='$(DESTDIR)$(libsubdir)'/$dir
929 ldir
='$(DESTDIR)$(libsubdir)'
931 echo ' $(INSTALL_DATA)' $out $ldir/
935 echo '.PHONY: all install'