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
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 # Flag whether we need eh_dummy.c
151 if [ "$SHLIB_LINK" ]; then
152 # Test -fvisibility=hidden. We need both a -fvisibility=hidden on
153 # the command line, and a #define to prevent libgcc2.h etc from
154 # overriding that with #pragmas. The dance with @ is to prevent
155 # echo from seeing anything it might take for an option.
156 # echo turns the \$\$\$\$ into $$$$ and when make sees it it
157 # becomes $$ and the shell substitutes the pid. Makes for a
158 # slightly safer temp file.
159 echo "vis_hide := \$(strip \$(subst @,-,\\"
160 echo " \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
161 echo " $gcc_compile -fvisibility=hidden -Werror \\"
162 echo " -c -xc - -o vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
163 echo " then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
164 echo " rm vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
168 # If we have -fvisibility=hidden, then we need to generate hide
169 # lists for object files implemented in assembly. The default
170 # pseudo-op for this is ".hidden", but can be overridden with
172 [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP
=".hidden"
174 echo "ifneq (,\$(vis_hide))"
175 echo "define gen-hide-list"
176 echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
177 # non-GNU nm emits three fields even for undefined and typeless symbols,
178 # so explicitly omit them
179 echo " \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
180 echo "mv -f \$@T \$@"
183 echo "gen-hide-list = echo > \$@"
187 # It is too hard to guarantee that vis_hide and gen-hide-list will never
188 # be referenced if SHLIB_LINK is not set, so set them to the values they'd
189 # have if SHLIB_LINK were set and we didn't have visibility support.
191 echo "gen-hide-list = echo > \$@"
194 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
195 # defined as optimized assembly code in LIB1ASMFUNCS or as C code
196 # in LIB2FUNCS_EXCLUDE.
197 for name
in $LIB1ASMFUNCS $LIB2FUNCS_EXCLUDE; do
198 lib2funcs
=`echo $lib2funcs | sed -e 's/^'$name'[ :]//' \
199 -e 's/ '$name'[ :]/ /' \
201 LIB2_DIVMOD_FUNCS
=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
202 -e 's/ '$name' / /' \
207 # Rules to generate object files.
210 for ml
in $MULTILIBS; do
212 # Work out relevant parameters that depend only on the multilib.
213 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
214 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
216 libgcc_a
=$dir/libgcc.a
217 libgcov_a
=$dir/libgcov.a
223 if [ "$LIBUNWIND" ]; then
224 libunwind_a
=$dir/libunwind.a
226 if [ "$SHLIB_LINK" ]; then
227 libgcc_eh_a
=$dir/libgcc_eh.a
228 libgcc_s_so
=$dir/libgcc_s
${SHLIB_EXT}
229 if [ "$LIBUNWIND" ]; then
230 libunwind_so
=$dir/libunwind
${SHLIB_EXT}
232 os_multilib_dir
=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
233 if [ "$os_multilib_dir" != .
]; then
234 shlib_slibdir_qual
="/$os_multilib_dir"
245 echo \
# flags: $flags
246 echo \
# libgcc_a: $libgcc_a
247 echo \
# libgcov_a: $libgcov_a
248 echo \
# libgcc_eh_a: $libgcc_eh_a
249 echo \
# libunwind_a: $libunwind_a
251 echo \
# shlib_slibdir_qual: $shlib_slibdir_qual
252 echo \
# libgcc_s_so: $libgcc_s_so
253 echo \
# libunwind_so: $libunwind_so
257 # Update list of directories.
258 if [ $dir != .
]; then
259 echo "dirs += ${dir} libgcc/${dir}"
264 # Build libgcc1 components.
266 for name
in $LIB1ASMFUNCS; do
267 if [ "$libgcc_s_so" ]; then
268 out
="libgcc/${dir}/${name}${objext}"
269 outS
="libgcc/${dir}/${name}_s${objext}"
270 outV
="libgcc/${dir}/${name}.vis"
272 echo ${outS}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
273 echo " $gcc_s_compile" $flags -DL$name -xassembler-with-cpp \
274 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $outS
276 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)' ${outV}
277 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
278 -c '$(srcdir)/config/$(LIB1ASMSRC)' -include $outV -o $out
280 echo "${outV}: ${outS}; \$(gen-hide-list)"
283 echo $libgcc_s_so: $outS
284 if [ "$SHLIB_MKMAP" ]; then
285 echo libgcc
/${dir}/libgcc.map
: $outS
288 out
="libgcc/${dir}/${name}${objext}"
289 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
290 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
291 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
297 # Build libgcc2 components.
300 for name
in $lib2funcs; do
303 defines
=`echo $name | sed -e 's/.*:\(.*\):\(.*\)/-DL\1 -DLIBGCC2_UNITS_PER_WORD=\2/'`
304 name
=`echo $name | sed -e 's/\(.*\):.*:.*/\1/'`
310 if [ "$libgcc_s_so" ]; then
311 out
="libgcc/${dir}/${name}${objext}"
312 outS
="libgcc/${dir}/${name}_s${objext}"
314 echo $outS: $libgcc2_c_dep
315 echo " $gcc_s_compile" $flags $defines -c '$(srcdir)/libgcc2.c' \
318 echo $out: $libgcc2_c_dep
319 echo " $gcc_compile" $flags $defines '$(vis_hide)' \
320 -c '$(srcdir)/libgcc2.c' -o $out
323 echo $libgcc_s_so: $outS
324 if [ "$SHLIB_MKMAP" ]; then
325 echo libgcc
/${dir}/libgcc.map
: $outS
328 out
="libgcc/${dir}/${name}${objext}"
329 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
330 echo " $gcc_compile" $flags $defines -c '$(srcdir)/libgcc2.c' -o $out
335 for name
in $LIB2FUNCS_ST; do
336 out
="libgcc/${dir}/${name}${objext}"
338 echo $out: $libgcc2_c_dep
339 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
340 -c '$(srcdir)/libgcc2.c' -o $out
341 echo ${dir}/libgcc.a
: $out
344 for name
in $LIB2_DIVMOD_FUNCS; do
345 if [ "$libgcc_s_so" ]; then
346 out
="libgcc/${dir}/${name}${objext}"
347 outS
="libgcc/${dir}/${name}_s${objext}"
349 echo $outS: $libgcc2_c_dep
350 echo " $gcc_s_compile" $flags -DL$name \
351 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
353 echo $out: $libgcc2_c_dep
354 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
355 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
358 echo $libgcc_s_so: $outS
359 if [ "$SHLIB_MKMAP" ]; then
360 echo libgcc
/${dir}/libgcc.map
: $outS
363 out
="libgcc/${dir}/${name}${objext}"
364 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
365 echo " $gcc_compile" $flags -DL$name \
366 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
372 # Build software floating point functions.
375 for fpbit_var
in FPBIT DPBIT TPBIT
; do
376 fpfuncs_var
="${fpbit_var}_FUNCS"
377 eval fpbit
=\$
$fpbit_var
378 eval fpfuncs
=\$
$fpfuncs_var
380 if [ "$fpbit" ] ; then
381 for name
in $fpfuncs; do
383 # _sf_to_tf and _df_to_tf require tp-bit.c
385 _
[sd
]f_to_tf
) [ -z "$TPBIT" ] && continue;;
387 if [ "$libgcc_s_so" ]; then
388 out
="libgcc/${dir}/${name}${objext}"
389 outS
="libgcc/${dir}/${name}_s${objext}"
391 echo $outS: $fpbit $fpbit_c_dep
392 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
395 echo $out: $fpbit $fpbit_c_dep
396 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
397 '$(vis_hide)' -c $fpbit -o $out
400 echo $libgcc_s_so: $outS
401 if [ "$SHLIB_MKMAP" ]; then
402 echo libgcc
/${dir}/libgcc.map
: $outS
405 out
="libgcc/${dir}/${name}${objext}"
406 echo $out: $fpbit $fpbit_c_dep
407 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
416 if [ "@enable_decimal_float@" = "yes" -a -z "$libgcc_so" ]; then
417 # If $DFP_ENABLE is set, then we want all data type sizes.
418 if [ "$DFP_ENABLE" ] ; then
419 D32PBIT
=1; D64PBIT
=1; D128PBIT
=1
422 # Bring in the DFP support code if D32PBIT, D64PBIT or D128PBIT are set.
423 if [ -n "$D32PBIT" -o -n "$D64PBIT" -o -n "$D128PBIT" ] ; then
424 dec_filenames
="decContext decNumber decRound decLibrary decUtility"
427 # Only bring in decimal*.c files for types we support.
428 if [ -n "$D32PBIT" ] ; then
429 dec_filenames
="$dec_filenames decimal32"
431 if [ -n "$D64PBIT" ] ; then
432 dec_filenames
="$dec_filenames decimal64"
434 if [ -n "$D128PBIT" ] ; then
435 dec_filenames
="$dec_filenames decimal128"
438 for name
in $dec_filenames ; do
439 out
="libgcc/${dir}/${name}${objext}"
440 echo $out: "\$(srcdir)/../libdecnumber/${name}.c" $decnumber_dep
441 echo " $gcc_compile" $flags -c "\$(srcdir)/../libdecnumber/${name}.c" -o $out
445 # For individual functions, loop over each variable by name.
446 for dpbit_var
in D32PBIT D64PBIT D128PBIT
; do
447 dpfuncs_var
="${dpbit_var}_FUNCS"
448 eval dpbit
=\$
$dpbit_var
449 eval dpfuncs
=\$
$dpfuncs_var
451 D32PBIT
) dpwidth
=32 ;;
452 D64PBIT
) dpwidth
=64 ;;
453 D128PBIT
) dpwidth
=128 ;;
456 if [ "$dpbit" ]; then
457 for name
in $dpfuncs; do
458 out
="libgcc/${dir}/${name}${objext}"
459 echo $out: config
/dfp-bit.h config
/dfp-bit.c
$fpbit_c_dep
460 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name -DWIDTH=$dpwidth \
461 $DFP_CFLAGS -c $\
(srcdir\
)/config
/dfp-bit.c
-o $out
468 for file in $LIB2ADD; do
469 name
=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
470 oname
=`echo $name | sed -e 's,.*/,,'`
472 if [ "$libgcc_s_so" ]; then
473 out
="libgcc/${dir}/${oname}${objext}"
474 outS
="libgcc/${dir}/${oname}_s${objext}"
478 echo $outS: stmp-dirs
$file $libgcc_dep
479 echo " $gcc_s_compile" $flags -c $file -o $outS
481 echo $out: stmp-dirs
$file $libgcc_dep
482 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
486 outV
="libgcc/${dir}/${oname}.vis"
488 echo $outS: stmp-dirs
$file $libgcc_dep
489 echo " $gcc_s_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}: ${outS}; \$(gen-hide-list)"
499 echo "Unhandled extension: $file" >&2
505 echo $libgcc_s_so: $outS
506 if [ "$SHLIB_MKMAP" ]; then
507 echo libgcc
/${dir}/libgcc.map
: $outS
510 out
="libgcc/${dir}/${oname}${objext}"
513 echo $out: stmp-dirs
$file $libgcc_dep
514 echo " $gcc_compile" $flags -c $file -o $out
518 echo $out: stmp-dirs
$file $libgcc_dep
519 echo " $gcc_compile" $flags -xassembler-with-cpp \
524 echo "Unhandled extension: $file" >&2
534 for file in $LIB2ADD_ST; do
535 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
536 oname
=`echo $name | sed -e 's,.*/,,'`
537 out
="libgcc/${dir}/${oname}${objext}"
541 echo $out: stmp-dirs
$file $libgcc_dep
542 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
546 # We may have to compile it twice in order to establish the list
547 # of symbols to be marked hidden.
548 if [ "$libgcc_so" ]; then
549 outV
="libgcc/${dir}/${oname}.vis"
550 outT
="libgcc/${dir}/${oname}_t${objext}"
551 echo ${outT}: stmp-dirs
$file $libgcc_dep
552 echo " $gcc_compile" $flags -xassembler-with-cpp \
554 echo $out: stmp-dirs
$file $libgcc_dep $outV
555 echo " $gcc_compile" $flags -xassembler-with-cpp \
556 -include $outV -c $file -o $out
557 echo "${outV}: ${outT}; \$(gen-hide-list)"
559 echo $out: stmp-dirs
$file $libgcc_dep
560 echo " $gcc_compile" $flags -xassembler-with-cpp \
566 echo "Unhandled extension: $file" >&2
573 # If we don't have libgcc_eh.a, only LIB2ADDEH matters. If we do, only
574 # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter. (Usually all three are
577 if [ "$libgcc_eh_a" ]; then
578 for file in $LIB2ADDEHSTATIC; do
579 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
580 oname
=`echo $name | sed -e 's,.*/,,'`
581 out
="libgcc/${dir}/${oname}${objext}"
585 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
586 echo " $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
589 # We have to compile it twice in order to establish the list
590 # of symbols to be marked hidden.
591 outV
="libgcc/${dir}/${oname}.vis"
592 outT
="libgcc/${dir}/${oname}_t${objext}"
593 echo ${outT}: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
594 echo " $gcc_compile" $flags -xassembler-with-cpp \
596 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep $outV
597 echo " $gcc_compile" $flags -xassembler-with-cpp \
598 -include $outV -c $file -o $out
599 echo "${outV}: ${outT}; \$(gen-hide-list)"
601 *) echo "Unhandled extension: $file">&2; exit 1 ;;
604 echo $libgcc_eh_a: $out
607 for file in $LIB2ADDEHSHARED; do
608 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
609 oname
=`echo $name | sed -e 's,.*/,,'`
610 outS
="libgcc/${dir}/${oname}_s${objext}"
614 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
615 echo " $gcc_s_compile" $flags -fexceptions -c $file -o $outS
618 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
619 echo " $gcc_s_compile" $flags -xassembler-with-cpp -c $file -o $outS
621 *) echo "Unhandled extension: $file">&2; exit 1 ;;
624 echo $libgcc_s_so: $outS
625 if [ "$SHLIB_MKMAP" ]; then
626 echo libgcc
/${dir}/libgcc.map
: $outS
630 # If nothing went into libgcc_eh.a, create a dummy object -
631 # some linkers don't like totally empty archives.
632 if [ -z "$LIB2ADDEHSTATIC" ]; then
634 out
="libgcc/${dir}/eh_dummy${objext}"
637 echo $out: stmp-dirs
$file
638 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
639 echo $libgcc_eh_a: $out
643 else # no libgcc_eh.a
644 for file in $LIB2ADDEH; do
645 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
646 oname
=`echo $name | sed -e 's,.*/,,'`
647 out
="libgcc/${dir}/${oname}${objext}"
651 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
652 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
655 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
656 echo " $gcc_compile" $flags -xassembler-with-cpp \
659 *) echo "Unhandled extension: $file">&2; exit 1 ;;
666 # We do _not_ handle assembly files in this context.
667 if [ "$LIBUNWIND" ]; then
668 for file in $LIBUNWIND; do
671 *) echo "Unhandled extension: $file">&2; exit 1 ;;
674 name
=`echo $file | sed -e 's/[.]c$//'`
675 oname
=`echo $name | sed -e 's,.*/,,'`
677 if [ "$libunwind_so" ]; then
678 out
="libgcc/${dir}/${oname}${objext}"
679 outS
="libgcc/${dir}/${oname}_s${objext}"
681 echo $out: stmp-dirs
$file $LIBUNWINDDEP
682 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
684 echo $outS: stmp-dirs
$file $LIBUNWINDDEP
685 echo " $gcc_s_compile $flags -fexceptions -c $file -o $outS"
687 echo $libunwind_a: $out
688 echo $libunwind_so: $outS
690 out
="libgcc/${dir}/${oname}${objext}"
691 echo $out: stmp-dirs
$file $LIBUNWINDDEP
692 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
693 echo $libunwind_a: $out
699 # build libgcov components
701 for name
in $LIBGCOV; do
702 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
703 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
704 out
="libgcc/${dir}/${name}${objext}"
706 echo $out: $libgcov_c_dep
707 echo " $gcc_compile $flags -DL$name -c \$(srcdir)/libgcov.c -o $out"
708 echo $libgcov_a: $out
711 # EXTRA_MULTILIB_PARTS.
712 if [ -n "$EXTRA_MULTILIB_PARTS" ]; then
713 # Each of the EXTRA_MULTILIB_PARTS is built by recursive invocation
714 # of the parent Makefile. We must do this just once for each
715 # multilib, passing it all the EXTRA_MULTILIB_PARTS as
716 # simultaneous goal targets, so that rules which cannot execute
717 # simultaneously are properly serialized.
721 for f
in $EXTRA_MULTILIB_PARTS; do
724 *) out
=$dir/$f ; t
=$dir/ ;;
727 # Prevent `make' from interpreting $out as a macro assignment
728 *'$(EQ)'*) targ
="T_TARGET=$out T_TARGET" ;;
734 if [ "$dir" = .
]; then
737 suffix
=`echo $dir | sed s,/,_,g`
739 echo extra
$suffix: stmp-dirs
740 echo " $make_compile" \\
741 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
742 echo ' MULTILIB_CFLAGS="'$flags'"' T
=$t $extra
743 echo "all: extra$suffix"
745 # Make libunwind.so and libgcc_s.so depend on these, since they
746 # are likely to be implicitly used by the link process.
747 if [ "$libgcc_s_so" ]; then
748 echo "$libgcc_s_so: extra$suffix"
750 if [ "$libunwind_so" ]; then
751 echo "$libunwind_so: extra$suffix"
755 # Library build rules.
756 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
757 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
759 # Map-file generation.
760 if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
761 mapfile
="libgcc/${dir}/libgcc.map"
762 tmpmapfile
="libgcc/${dir}/tmp-libgcc.map"
763 # This uses a here document instead of echos because some shells
764 # will convert the \1 in the second sed command to a control-A.
765 # The behavior of here documents is more predictable.
768 ${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES
769 { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS \$(objects); echo %%; \\
770 cat $SHLIB_MAPFILES \\
771 | sed -e '/^[ ]*#/d' \\
772 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
773 | $gcc_compile $flags -E -xassembler-with-cpp -; \\
774 } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
776 $libgcc_s_so: ${mapfile}
782 # Each of these .a files depends on stmp-dirs. It would seem that
783 # this dependency is redundant, since each of the object files
784 # itself depends on stmp-dirs. However, it is possible that there
785 # are in fact no object files. In that case, the stmp-dirs
786 # dependency is required; the directory containing the archive must
787 # exist before the archive itself can be created.
789 echo "$libgcc_a: stmp-dirs"
790 echo " -rm -f $libgcc_a"
791 echo ' $(AR_CREATE_FOR_TARGET)' $libgcc_a '$(objects)'
792 echo ' $(RANLIB_FOR_TARGET)' $libgcc_a
793 echo "all: $libgcc_a"
796 echo "$libgcov_a: stmp-dirs"
797 echo " -rm -f $libgcov_a"
798 echo ' $(AR_CREATE_FOR_TARGET)' $libgcov_a '$(objects)'
799 echo ' $(RANLIB_FOR_TARGET)' $libgcov_a
800 echo "all: $libgcov_a"
802 # These libraries are not always built.
803 if [ "$libunwind_a" ]; then
805 echo "$libunwind_a: stmp-dirs"
806 echo " -rm -f $libunwind_a"
807 echo ' $(AR_CREATE_FOR_TARGET)' $libunwind_a '$(objects)'
808 echo ' $(RANLIB_FOR_TARGET)' $libunwind_a
809 echo "all: $libunwind_a"
812 if [ "$libgcc_eh_a" ]; then
814 echo "${dir}/libgcc_eh.a: stmp-dirs"
815 echo " -rm -f ${dir}/libgcc_eh.a"
816 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a
'$(objects)'
817 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
818 echo "all: $libgcc_eh_a"
822 if [ "$libgcc_s_so" ]; then
824 echo "$libgcc_s_so: stmp-dirs $libunwind_so"
825 echo " $SHLIB_LINK" \
826 |
sed -e "s%@multilib_flags@%$flags%g" \
827 -e "s%@multilib_dir@%$dir%g" \
828 -e "s%@shlib_objs@%\$(objects)%g" \
829 -e "s%@shlib_base_name@%libgcc_s%g" \
830 -e "s%@shlib_map_file@%$mapfile%g" \
831 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
832 echo "all: $libgcc_s_so"
835 if [ "$libunwind_so" ]; then
837 echo "$libunwind_so: stmp-dirs"
838 echo " $SHLIBUNWIND_LINK" \
839 |
sed -e "s%@multilib_flags@%$flags%g" \
840 -e "s%@multilib_dir@%$dir%g" \
841 -e "s%@shlib_objs@%\$(objects)%g" \
842 -e "s%@shlib_base_name@%libunwind%g" \
843 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
844 echo "all: $libunwind_so"
847 done # ml in MULTILIBS
850 echo "libgcc-stage-start:"
851 echo " for dir in \$(dirs); do \\"
852 echo " if [ -d \$(stage)/\$\$dir ]; then :; \\"
853 echo " else $mkinstalldirs \$(stage)/\$\$dir; fi; \\"
855 echo " -for dir in \$(dirs); do \\"
856 echo " mv \$\$dir/*${objext} \$(stage)/\$\$dir; \\"
857 echo " mv \$\$dir/*.vis \$(stage)/\$\$dir; \\"
858 echo " mv \$\$dir/*.map \$(stage)/\$\$dir; \\"
859 echo " test ! -f \$\$dir/libgcc.a || mv \$\$dir/lib* \$(stage)/\$\$dir; \\"
864 echo " for d in \$(dirs); do \\"
865 echo " if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
867 echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
869 if [ "$need_eh_dummy" ]; then
871 echo " echo 'int __libgcc_eh_dummy;' > \$@"
876 for ml
in $MULTILIBS; do
877 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
878 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
879 if [ $dir != .
]; then
880 ldir
='$(DESTDIR)$(libsubdir)'/$dir
881 echo " if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
883 ldir
='$(DESTDIR)$(libsubdir)'
885 echo ' $(INSTALL_DATA)' ${dir}/libgcc.a
${ldir}/
886 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
887 echo ' $(INSTALL_DATA)' ${dir}/libgcov.a
${ldir}/
888 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
890 if [ "$SHLIB_LINK" ]; then
891 echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a
${ldir}/
892 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
895 os_multilib_dir
=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
896 if [ "$os_multilib_dir" != .
]; then
897 shlib_slibdir_qual
="/$os_multilib_dir"
899 echo " $SHLIB_INSTALL" \
900 |
sed -e "s%@multilib_dir@%$dir%g" \
901 -e "s%@shlib_base_name@%libgcc_s%g" \
902 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
903 if [ "$LIBUNWIND" ]; then
904 echo " $SHLIBUNWIND_INSTALL" \
905 |
sed -e "s%@multilib_dir@%$dir%g" \
906 -e "s%@shlib_base_name@%libunwind%g" \
907 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
908 libunwinddir
='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
909 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a
${libunwinddir}/
910 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
914 for f
in $EXTRA_MULTILIB_PARTS; do
915 for ml
in $MULTILIBS; do
916 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
917 if [ $dir != .
]; then
919 ldir
='$(DESTDIR)$(libsubdir)'/$dir
922 ldir
='$(DESTDIR)$(libsubdir)'
924 echo ' $(INSTALL_DATA)' $out $ldir/
928 echo '.PHONY: all install'