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.
27 # LIB2_SIDITI_CONV_FUNCS
34 # EXTRA_MULTILIB_PARTS
46 # Make needs VPATH to be literal.
47 echo 'srcdir = @srcdir@'
48 echo 'VPATH = @srcdir@'
50 echo 'objects = $(filter %'$objext',$^)'
52 echo '# Dependencies are accumulated as we go.'
57 # The floating-point conversion routines that involve a single-word integer.
58 # XX stands for the integer mode.
60 for mode
in sf df xf
; do
61 swfloatfuncs
="$swfloatfuncs _fixuns${mode}XX"
64 # Likewise double-word routines.
66 for mode
in sf df xf tf
; do
67 dwfloatfuncs
="$dwfloatfuncs _fix${mode}XX _fixuns${mode}XX"
68 dwfloatfuncs
="$dwfloatfuncs _floatXX${mode}"
71 # Entries of the form <objfile>:<func>:<wordsize> indicate that libgcc2.c
72 # should be compiled with L<func> defined and with LIBGCC2_UNITS_PER_WORD
73 # set to <wordsize>. <objfile> is the name of the associated object file
75 lib2funcs
='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
76 _cmpdi2 _ucmpdi2 _clear_cache
77 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3
78 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
79 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
80 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
81 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
84 if [ "$LIB2_SIDITI_CONV_FUNCS" ]; then
85 for func
in $swfloatfuncs; do
86 sifunc
=`echo $func | sed -e 's/XX/si/'`
87 lib2funcs
="$lib2funcs $sifunc:$sifunc:4"
89 for func
in $dwfloatfuncs; do
90 difunc
=`echo $func | sed -e 's/XX/di/'`
91 tifunc
=`echo $func | sed -e 's/XX/ti/'`
92 lib2funcs
="$lib2funcs $difunc:$difunc:4 $tifunc:$difunc:8"
95 lib2funcs
="$lib2funcs `echo $swfloatfuncs | sed -e 's/XX/si/g'`"
96 lib2funcs
="$lib2funcs `echo $dwfloatfuncs | sed -e 's/XX/di/g'`"
99 # Disable SHLIB_LINK if shared libgcc not enabled.
100 if [ "@enable_shared@" = "no" ]; then
106 gcc_compile
='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
107 gcc_s_compile
="$gcc_compile -DSHARED"
108 make_compile
='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
109 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
110 AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
111 AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
112 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
113 CC="$(CC)" CFLAGS="$(CFLAGS)" \
114 BUILD_PREFIX="$(BUILD_PREFIX)" \
115 BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \
116 LANGUAGES="$(LANGUAGES)"'
118 # Generic dependencies for libgcc
119 libgcc_dep
='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'
121 # Dependencies for libgcc2.c
122 libgcc2_c_dep
='stmp-dirs $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h gbl-ctors.h'" $libgcc_dep"
124 # Dependencies for libgcov.c
125 libgcov_c_dep
='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"
127 # Dependencies for fp-bit.c
128 fpbit_c_dep
='stmp-dirs config.status tsystem.h'
130 # Flag whether we need eh_dummy.c
133 if [ "$SHLIB_LINK" ]; then
134 # Test -fvisibility=hidden. We need both a -fvisibility=hidden on
135 # the command line, and a #define to prevent libgcc2.h etc from
136 # overriding that with #pragmas. The dance with @ is to prevent
137 # echo from seeing anything it might take for an option.
138 # echo turns the \$\$\$\$ into $$$$ and when make sees it it
139 # becomes $$ and the shell substitutes the pid. Makes for a
140 # slightly safer temp file.
141 echo "vis_hide := \$(strip \$(subst @,-,\\"
142 echo " \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
143 echo " $gcc_compile -fvisibility=hidden -Werror \\"
144 echo " -c -xc - -o vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
145 echo " then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
146 echo " rm vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
150 # If we have -fvisibility=hidden, then we need to generate hide
151 # lists for object files implemented in assembly. The default
152 # pseudo-op for this is ".hidden", but can be overridden with
154 [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP
=".hidden"
156 echo "ifneq (,\$(vis_hide))"
157 echo "define gen-hide-list"
158 echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
159 # non-GNU nm emits three fields even for undefined and typeless symbols,
160 # so explicitly omit them
161 echo " \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
162 echo "mv -f \$@T \$@"
165 echo "gen-hide-list = echo > \$@"
169 # It is too hard to guarantee that vis_hide and gen-hide-list will never
170 # be referenced if SHLIB_LINK is not set, so set them to the values they'd
171 # have if SHLIB_LINK were set and we didn't have visibility support.
173 echo "gen-hide-list = echo > \$@"
176 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
177 # defined as optimized assembly code in LIB1ASMFUNCS.
178 for name
in $LIB1ASMFUNCS; do
179 lib2funcs
=`echo $lib2funcs | sed -e 's/^'$name'[ :]//' \
180 -e 's/ '$name'[ :]/ /' \
182 LIB2_DIVMOD_FUNCS
=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
183 -e 's/ '$name' / /' \
188 # Rules to generate object files.
191 for ml
in $MULTILIBS; do
193 # Work out relevant parameters that depend only on the multilib.
194 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
195 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
197 libgcc_a
=$dir/libgcc.a
198 libgcov_a
=$dir/libgcov.a
204 if [ "$LIBUNWIND" ]; then
205 libunwind_a
=$dir/libunwind.a
207 if [ "$SHLIB_LINK" ]; then
208 libgcc_eh_a
=$dir/libgcc_eh.a
209 libgcc_s_so
=$dir/libgcc_s
${SHLIB_EXT}
210 if [ "$LIBUNWIND" ]; then
211 libunwind_so
=$dir/libunwind
${SHLIB_EXT}
213 os_multilib_dir
=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
214 if [ "$os_multilib_dir" != .
]; then
215 shlib_slibdir_qual
="/$os_multilib_dir"
226 echo \
# flags: $flags
227 echo \
# libgcc_a: $libgcc_a
228 echo \
# libgcov_a: $libgcov_a
229 echo \
# libgcc_eh_a: $libgcc_eh_a
230 echo \
# libunwind_a: $libunwind_a
232 echo \
# shlib_slibdir_qual: $shlib_slibdir_qual
233 echo \
# libgcc_s_so: $libgcc_s_so
234 echo \
# libunwind_so: $libunwind_so
238 # Update list of directories.
239 if [ $dir != .
]; then
240 echo "dirs += ${dir} libgcc/${dir}"
245 # Build libgcc1 components.
247 for name
in $LIB1ASMFUNCS; do
248 if [ "$libgcc_s_so" ]; then
249 out
="libgcc/${dir}/${name}${objext}"
250 outS
="libgcc/${dir}/${name}_s${objext}"
251 outV
="libgcc/${dir}/${name}.vis"
253 echo ${outS}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
254 echo " $gcc_s_compile" $flags -DL$name -xassembler-with-cpp \
255 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $outS
257 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)' ${outV}
258 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
259 -c '$(srcdir)/config/$(LIB1ASMSRC)' -include $outV -o $out
261 echo "${outV}: ${outS}; \$(gen-hide-list)"
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 -xassembler-with-cpp \
272 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
278 # Build libgcc2 components.
281 for name
in $lib2funcs; do
284 defines
=`echo $name | sed -e 's/.*:\(.*\):\(.*\)/-DL\1 -DLIBGCC2_UNITS_PER_WORD=\2/'`
285 name
=`echo $name | sed -e 's/\(.*\):.*:.*/\1/'`
291 if [ "$libgcc_s_so" ]; then
292 out
="libgcc/${dir}/${name}${objext}"
293 outS
="libgcc/${dir}/${name}_s${objext}"
295 echo $outS: $libgcc2_c_dep
296 echo " $gcc_s_compile" $flags $defines -c '$(srcdir)/libgcc2.c' \
299 echo $out: $libgcc2_c_dep
300 echo " $gcc_compile" $flags $defines '$(vis_hide)' \
301 -c '$(srcdir)/libgcc2.c' -o $out
304 echo $libgcc_s_so: $outS
305 if [ "$SHLIB_MKMAP" ]; then
306 echo libgcc
/${dir}/libgcc.map
: $outS
309 out
="libgcc/${dir}/${name}${objext}"
310 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
311 echo " $gcc_compile" $flags $defines -c '$(srcdir)/libgcc2.c' -o $out
316 for name
in $LIB2FUNCS_ST; do
317 out
="libgcc/${dir}/${name}${objext}"
319 echo $out: $libgcc2_c_dep
320 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
321 -c '$(srcdir)/libgcc2.c' -o $out
322 echo ${dir}/libgcc.a
: $out
325 for name
in $LIB2_DIVMOD_FUNCS; do
326 if [ "$libgcc_s_so" ]; then
327 out
="libgcc/${dir}/${name}${objext}"
328 outS
="libgcc/${dir}/${name}_s${objext}"
330 echo $outS: $libgcc2_c_dep
331 echo " $gcc_s_compile" $flags -DL$name \
332 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
334 echo $out: $libgcc2_c_dep
335 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
336 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
339 echo $libgcc_s_so: $outS
340 if [ "$SHLIB_MKMAP" ]; then
341 echo libgcc
/${dir}/libgcc.map
: $outS
344 out
="libgcc/${dir}/${name}${objext}"
345 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
346 echo " $gcc_compile" $flags -DL$name \
347 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
353 # Build software floating point functions.
356 if [ "$FPBIT" ]; then
357 for name
in $FPBIT_FUNCS; do
358 [ "$name" = _sf_to_tf
-a -z "$TPBIT" ] && continue
359 if [ "$libgcc_s_so" ]; then
360 out
="libgcc/${dir}/${name}${objext}"
361 outS
="libgcc/${dir}/${name}_s${objext}"
363 echo $outS: $FPBIT $fpbit_c_dep
364 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
367 echo $out: $FPBIT $fpbit_c_dep
368 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
369 '$(vis_hide)' -c $FPBIT -o $out
372 echo $libgcc_s_so: $outS
373 if [ "$SHLIB_MKMAP" ]; then
374 echo libgcc
/${dir}/libgcc.map
: $outS
377 out
="libgcc/${dir}/${name}${objext}"
378 echo $out: $FPBIT $fpbit_c_dep
379 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
387 if [ "$DPBIT" ]; then
388 for name
in $DPBIT_FUNCS; do
389 [ "$name" = _df_to_tf
-a -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: $DPBIT $fpbit_c_dep
395 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
398 echo $out: $DPBIT $fpbit_c_dep
399 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
400 '$(vis_hide)' -c $DPBIT -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: $DPBIT $fpbit_c_dep
410 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
418 if [ "$TPBIT" ]; then
419 for name
in $TPBIT_FUNCS; do
420 if [ "$libgcc_s_so" ]; then
421 out
="libgcc/${dir}/${name}${objext}"
422 outS
="libgcc/${dir}/${name}_s${objext}"
424 echo $outS: $TPBIT $fpbit_c_dep
425 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
428 echo $out: $TPBIT $fpbit_c_dep
429 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
430 '$(vis_hide)' -c $TPBIT -o $out
433 echo $libgcc_s_so: $outS
434 if [ "$SHLIB_MKMAP" ]; then
435 echo libgcc
/${dir}/libgcc.map
: $outS
438 out
="libgcc/${dir}/${name}${objext}"
439 echo $out: $TPBIT $fpbit_c_dep
440 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
448 for file in $LIB2ADD; do
449 name
=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
450 oname
=`echo $name | sed -e 's,.*/,,'`
452 if [ "$libgcc_s_so" ]; then
453 out
="libgcc/${dir}/${oname}${objext}"
454 outS
="libgcc/${dir}/${oname}_s${objext}"
458 echo $outS: stmp-dirs
$file $libgcc_dep
459 echo " $gcc_s_compile" $flags -c $file -o $outS
461 echo $out: stmp-dirs
$file $libgcc_dep
462 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
466 outV
="libgcc/${dir}/${oname}.vis"
468 echo $outS: stmp-dirs
$file $libgcc_dep
469 echo " $gcc_s_compile" $flags -xassembler-with-cpp \
472 echo $out: stmp-dirs
$file $libgcc_dep $outV
473 echo " $gcc_compile" $flags -xassembler-with-cpp \
474 -include $outV -c $file -o $out
475 echo "${outV}: ${outS}; \$(gen-hide-list)"
479 echo "Unhandled extension: $file" >&2
485 echo $libgcc_s_so: $outS
486 if [ "$SHLIB_MKMAP" ]; then
487 echo libgcc
/${dir}/libgcc.map
: $outS
490 out
="libgcc/${dir}/${oname}${objext}"
493 echo $out: stmp-dirs
$file $libgcc_dep
494 echo " $gcc_compile" $flags -c $file -o $out
498 echo $out: stmp-dirs
$file $libgcc_dep
499 echo " $gcc_compile" $flags -xassembler-with-cpp \
504 echo "Unhandled extension: $file" >&2
514 for file in $LIB2ADD_ST; do
515 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
516 oname
=`echo $name | sed -e 's,.*/,,'`
517 out
="libgcc/${dir}/${oname}${objext}"
521 echo $out: stmp-dirs
$file $libgcc_dep
522 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
526 # We may have to compile it twice in order to establish the list
527 # of symbols to be marked hidden.
528 if [ "$libgcc_so" ]; then
529 outV
="libgcc/${dir}/${oname}.vis"
530 outT
="libgcc/${dir}/${oname}_t${objext}"
531 echo ${outT}: stmp-dirs
$file $libgcc_dep
532 echo " $gcc_compile" $flags -xassembler-with-cpp \
534 echo $out: stmp-dirs
$file $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 $out: stmp-dirs
$file $libgcc_dep
540 echo " $gcc_compile" $flags -xassembler-with-cpp \
546 echo "Unhandled extension: $file" >&2
553 # If we don't have libgcc_eh.a, only LIB2ADDEH matters. If we do, only
554 # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter. (Usually all three are
557 if [ "$libgcc_eh_a" ]; then
558 for file in $LIB2ADDEHSTATIC; do
559 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
560 oname
=`echo $name | sed -e 's,.*/,,'`
561 out
="libgcc/${dir}/${oname}${objext}"
565 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
566 echo " $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
569 # We have to compile it twice in order to establish the list
570 # of symbols to be marked hidden.
571 outV
="libgcc/${dir}/${oname}.vis"
572 outT
="libgcc/${dir}/${oname}_t${objext}"
573 echo ${outT}: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
574 echo " $gcc_compile" $flags -xassembler-with-cpp \
576 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep $outV
577 echo " $gcc_compile" $flags -xassembler-with-cpp \
578 -include $outV -c $file -o $out
579 echo "${outV}: ${outT}; \$(gen-hide-list)"
581 *) echo "Unhandled extension: $file">&2; exit 1 ;;
584 echo $libgcc_eh_a: $out
587 for file in $LIB2ADDEHSHARED; do
588 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
589 oname
=`echo $name | sed -e 's,.*/,,'`
590 outS
="libgcc/${dir}/${oname}_s${objext}"
594 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
595 echo " $gcc_s_compile" $flags -fexceptions -c $file -o $outS
598 echo $outS: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
599 echo " $gcc_s_compile" $flags -xassembler-with-cpp -c $file -o $outS
601 *) echo "Unhandled extension: $file">&2; exit 1 ;;
604 echo $libgcc_s_so: $outS
605 if [ "$SHLIB_MKMAP" ]; then
606 echo libgcc
/${dir}/libgcc.map
: $outS
610 # If nothing went into libgcc_eh.a, create a dummy object -
611 # some linkers don't like totally empty archives.
612 if [ -z "$LIB2ADDEHSTATIC" ]; then
614 out
="libgcc/${dir}/eh_dummy${objext}"
617 echo $out: stmp-dirs
$file
618 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
619 echo $libgcc_eh_a: $out
623 else # no libgcc_eh.a
624 for file in $LIB2ADDEH; do
625 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
626 oname
=`echo $name | sed -e 's,.*/,,'`
627 out
="libgcc/${dir}/${oname}${objext}"
631 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
632 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
635 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
636 echo " $gcc_compile" $flags -xassembler-with-cpp \
639 *) echo "Unhandled extension: $file">&2; exit 1 ;;
646 # We do _not_ handle assembly files in this context.
647 if [ "$LIBUNWIND" ]; then
648 for file in $LIBUNWIND; do
651 *) echo "Unhandled extension: $file">&2; exit 1 ;;
654 name
=`echo $file | sed -e 's/[.]c$//'`
655 oname
=`echo $name | sed -e 's,.*/,,'`
657 if [ "$libunwind_so" ]; then
658 out
="libgcc/${dir}/${oname}${objext}"
659 outS
="libgcc/${dir}/${oname}_s${objext}"
661 echo $out: stmp-dirs
$file $LIBUNWINDDEP
662 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
664 echo $outS: stmp-dirs
$file $LIBUNWINDDEP
665 echo " $gcc_s_compile $flags -fexceptions -c $file -o $outS"
667 echo $libunwind_a: $out
668 echo $libunwind_so: $outS
670 out
="libgcc/${dir}/${oname}${objext}"
671 echo $out: stmp-dirs
$file $LIBUNWINDDEP
672 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
673 echo $libunwind_a: $out
679 # build libgcov components
681 for name
in $LIBGCOV; do
682 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
683 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
684 out
="libgcc/${dir}/${name}${objext}"
686 echo $out: $libgcov_c_dep
687 echo " $gcc_compile $flags -DL$name -c \$(srcdir)/libgcov.c -o $out"
688 echo $libgcov_a: $out
691 # EXTRA_MULTILIB_PARTS.
692 if [ -n "$EXTRA_MULTILIB_PARTS" ]; then
693 # Each of the EXTRA_MULTILIB_PARTS is built by recursive invocation
694 # of the parent Makefile. We must do this just once for each
695 # multilib, passing it all the EXTRA_MULTILIB_PARTS as
696 # simultaneous goal targets, so that rules which cannot execute
697 # simultaneously are properly serialized.
701 for f
in $EXTRA_MULTILIB_PARTS; do
704 *) out
=$dir/$f ; t
=$dir/ ;;
707 # Prevent `make' from interpreting $out as a macro assignment
708 *'$(EQ)'*) targ
="T_TARGET=$out T_TARGET" ;;
714 if [ "$dir" = .
]; then
717 suffix
=`echo $dir | sed s,/,_,g`
719 echo extra
$suffix: stmp-dirs
720 echo " $make_compile" \\
721 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
722 echo ' MULTILIB_CFLAGS="'$flags'"' T
=$t $extra
723 echo "all: extra$suffix"
725 # Make libunwind.so and libgcc_s.so depend on these, since they
726 # are likely to be implicitly used by the link process.
727 if [ "$libgcc_s_so" ]; then
728 echo "$libgcc_s_so: extra$suffix"
730 if [ "$libunwind_so" ]; then
731 echo "$libunwind_so: extra$suffix"
735 # Library build rules.
736 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
737 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
739 # Map-file generation.
740 if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
741 mapfile
="libgcc/${dir}/libgcc.map"
742 tmpmapfile
="libgcc/${dir}/tmp-libgcc.map"
743 # This uses a here document instead of echos because some shells
744 # will convert the \1 in the second sed command to a control-A.
745 # The behavior of here documents is more predictable.
748 ${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES
749 { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS \$(objects); echo %%; \\
750 cat $SHLIB_MAPFILES \\
751 | sed -e '/^[ ]*#/d' \\
752 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
753 | $gcc_compile $flags -E -xassembler-with-cpp -; \\
754 } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
756 $libgcc_s_so: ${mapfile}
762 # Each of these .a files depends on stmp-dirs. It would seem that
763 # this dependency is redundant, since each of the object files
764 # itself depends on stmp-dirs. However, it is possible that there
765 # are in fact no object files. In that case, the stmp-dirs
766 # dependency is required; the directory containing the archive must
767 # exist before the archive itself can be created.
769 echo "$libgcc_a: stmp-dirs"
770 echo " -rm -f $libgcc_a"
771 echo ' $(AR_CREATE_FOR_TARGET)' $libgcc_a '$(objects)'
772 echo ' $(RANLIB_FOR_TARGET)' $libgcc_a
773 echo "all: $libgcc_a"
776 echo "$libgcov_a: stmp-dirs"
777 echo " -rm -f $libgcov_a"
778 echo ' $(AR_CREATE_FOR_TARGET)' $libgcov_a '$(objects)'
779 echo ' $(RANLIB_FOR_TARGET)' $libgcov_a
780 echo "all: $libgcov_a"
782 # These libraries are not always built.
783 if [ "$libunwind_a" ]; then
785 echo "$libunwind_a: stmp-dirs"
786 echo " -rm -f $libunwind_a"
787 echo ' $(AR_CREATE_FOR_TARGET)' $libunwind_a '$(objects)'
788 echo ' $(RANLIB_FOR_TARGET)' $libunwind_a
789 echo "all: $libunwind_a"
792 if [ "$libgcc_eh_a" ]; then
794 echo "${dir}/libgcc_eh.a: stmp-dirs"
795 echo " -rm -f ${dir}/libgcc_eh.a"
796 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a
'$(objects)'
797 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
798 echo "all: $libgcc_eh_a"
802 if [ "$libgcc_s_so" ]; then
804 echo "$libgcc_s_so: stmp-dirs $libunwind_so"
805 echo " $SHLIB_LINK" \
806 |
sed -e "s%@multilib_flags@%$flags%g" \
807 -e "s%@multilib_dir@%$dir%g" \
808 -e "s%@shlib_objs@%\$(objects)%g" \
809 -e "s%@shlib_base_name@%libgcc_s%g" \
810 -e "s%@shlib_map_file@%$mapfile%g" \
811 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
812 echo "all: $libgcc_s_so"
815 if [ "$libunwind_so" ]; then
817 echo "$libunwind_so: stmp-dirs"
818 echo " $SHLIBUNWIND_LINK" \
819 |
sed -e "s%@multilib_flags@%$flags%g" \
820 -e "s%@multilib_dir@%$dir%g" \
821 -e "s%@shlib_objs@%\$(objects)%g" \
822 -e "s%@shlib_base_name@%libunwind%g" \
823 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
824 echo "all: $libunwind_so"
827 done # ml in MULTILIBS
830 echo "libgcc-stage-start:"
831 echo " for dir in \$(dirs); do \\"
832 echo " if [ -d \$(stage)/\$\$dir ]; then :; \\"
833 echo " else $mkinstalldirs \$(stage)/\$\$dir; fi; \\"
835 echo " -for dir in \$(dirs); do \\"
836 echo " mv \$\$dir/*${objext} \$(stage)/\$\$dir; \\"
837 echo " mv \$\$dir/*.vis \$(stage)/\$\$dir; \\"
838 echo " mv \$\$dir/*.map \$(stage)/\$\$dir; \\"
839 echo " test ! -f \$\$dir/libgcc.a || mv \$\$dir/lib* \$(stage)/\$\$dir; \\"
844 echo " for d in \$(dirs); do \\"
845 echo " if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
847 echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
849 if [ "$need_eh_dummy" ]; then
851 echo " echo 'int __libgcc_eh_dummy;' > \$@"
856 for ml
in $MULTILIBS; do
857 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
858 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
859 if [ $dir != .
]; then
860 ldir
='$(DESTDIR)$(libsubdir)'/$dir
861 echo " if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
863 ldir
='$(DESTDIR)$(libsubdir)'
865 echo ' $(INSTALL_DATA)' ${dir}/libgcc.a
${ldir}/
866 echo ' chmod 644' ${ldir}/libgcc.a
867 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
868 echo ' $(INSTALL_DATA)' ${dir}/libgcov.a
${ldir}/
869 echo ' chmod 644' ${ldir}/libgcov.a
870 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
872 if [ "$SHLIB_LINK" ]; then
873 echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a
${ldir}/
874 echo ' chmod 644' ${ldir}/libgcc_eh.a
875 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
878 os_multilib_dir
=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
879 if [ "$os_multilib_dir" != .
]; then
880 shlib_slibdir_qual
="/$os_multilib_dir"
882 echo " $SHLIB_INSTALL" \
883 |
sed -e "s%@multilib_dir@%$dir%g" \
884 -e "s%@shlib_base_name@%libgcc_s%g" \
885 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
886 if [ "$LIBUNWIND" ]; then
887 echo " $SHLIBUNWIND_INSTALL" \
888 |
sed -e "s%@multilib_dir@%$dir%g" \
889 -e "s%@shlib_base_name@%libunwind%g" \
890 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
891 libunwinddir
='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
892 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a
${libunwinddir}/
893 echo ' chmod 644' ${dir}/libunwind.a
894 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
898 for f
in $EXTRA_MULTILIB_PARTS; do
899 for ml
in $MULTILIBS; do
900 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
901 if [ $dir != .
]; then
903 ldir
='$(DESTDIR)$(libsubdir)'/$dir
906 ldir
='$(DESTDIR)$(libsubdir)'
908 echo ' $(INSTALL_DATA)' $out $ldir/
912 echo '.PHONY: all install'