2 # Construct makefile for libgcc.
3 # Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
5 # This file is part of GCC.
7 # Arguments, taken from the environment, since there are a lot
8 # of them, and positional args becomes quite ugly.
33 # EXTRA_MULTILIB_PARTS
45 # Make needs VPATH to be literal.
46 echo 'srcdir = @srcdir@'
47 echo 'VPATH = @srcdir@'
49 echo 'objects = $(filter %'$objext',$^)'
51 echo '# Dependencies are accumulated as we go.'
56 # Library members defined in libgcc2.c.
57 lib2funcs
='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
58 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi
59 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
60 _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache
61 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3
62 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
63 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
64 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
65 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
68 # Disable SHLIB_LINK if shared libgcc not enabled.
69 if [ "@enable_shared@" = "no" ]; then
75 gcc_compile
='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
76 make_compile
='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
77 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
78 AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
79 AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
80 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
81 CC="$(CC)" CFLAGS="$(CFLAGS)" \
82 BUILD_PREFIX="$(BUILD_PREFIX)" \
83 BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \
84 LANGUAGES="$(LANGUAGES)"'
86 # Generic dependencies for libgcc
87 libgcc_dep
='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'
89 # Dependencies for libgcc2.c
90 libgcc2_c_dep
='stmp-dirs $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h gbl-ctors.h'" $libgcc_dep"
92 # Dependencies for libgcov.c
93 libgcov_c_dep
='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"
95 # Dependencies for fp-bit.c
96 fpbit_c_dep
='stmp-dirs config.status tsystem.h'
98 if [ "$SHLIB_LINK" ]; then
99 # Test -fvisibility=hidden. We need both a -fvisibility=hidden on
100 # the command line, and a #define to prevent libgcc2.h etc from
101 # overriding that with #pragmas. The dance with @ is to prevent
102 # echo from seeing anything it might take for an option.
103 echo "vis_hide := \$(strip \$(subst @,-,\\"
104 echo " \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
105 echo " $gcc_compile -fvisibility=hidden -Werror \\"
106 echo " -c -xc - -o /dev/null 2> /dev/null; \\"
107 echo " then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
111 # If we have -fvisibility=hidden, then we need to generate hide
112 # lists for object files implemented in assembly. The default
113 # pseudo-op for this is ".hidden", but can be overridden with
115 [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP
=".hidden"
117 echo "ifneq (,\$(vis_hide))"
118 echo "define gen-hide-list"
119 echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
120 # non-GNU nm emits three fields even for undefined and typeless symbols,
121 # so explicitly omit them
122 echo " \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
123 echo "mv -f \$@T \$@"
126 echo "gen-hide-list = echo > \$@"
130 # It is too hard to guarantee that vis_hide and gen-hide-list will never
131 # be referenced if SHLIB_LINK is not set, so set them to the values they'd
132 # have if SHLIB_LINK were set and we didn't have visibility support.
134 echo "gen-hide-list = echo > \$@"
137 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
138 # defined as optimized assembly code in LIB1ASMFUNCS.
139 for name
in $LIB1ASMFUNCS; do
140 lib2funcs
=`echo $lib2funcs | sed -e 's/^'$name' //' \
141 -e 's/ '$name' / /' \
143 LIB2_DIVMOD_FUNCS
=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
144 -e 's/ '$name' / /' \
149 # Rules to generate object files.
152 for ml
in $MULTILIBS; do
154 # Work out relevant parameters that depend only on the multilib.
155 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
156 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
159 libgcc_a
=$dir/libgcc.a
160 libgcov_a
=$dir/libgcov.a
165 if [ "$dir" = .
]; then
168 suffix
=`echo $dir | sed s,/,_,g`
171 if [ "$LIBUNWIND" ]; then
172 libunwind_a
=$dir/libunwind.a
174 if [ "$SHLIB_LINK" ]; then
175 if [ -z "$SHLIB_MULTILIB" ]; then
176 if [ "$dir" = .
]; then
177 libgcc_eh_a
=$dir/libgcc_eh.a
178 libgcc_s_so_base
=libgcc_s
179 libgcc_s_so
=${libgcc_s_so_base}${SHLIB_EXT}
180 libgcc_s_soname
=libgcc_s
181 if [ "$LIBUNWIND" ]; then
182 libunwind_so_base
=libunwind
183 libunwind_so
=${libunwind_so_base}${SHLIB_EXT}
184 libunwind_soname
=libunwind
187 libgcc_eh_a
=$dir/libgcc_eh.a
188 libgcc_s_so_base
=libgcc_s_
${suffix}
189 libgcc_s_so
=${libgcc_s_so_base}${SHLIB_EXT}
190 libgcc_s_soname
=libgcc_s_
${suffix}
191 if [ "$LIBUNWIND" ]; then
192 libunwind_so_base
=libunwind_
${suffix}
193 libunwind_so
=${libunwind_so_base}${SHLIB_EXT}
197 if [ -n "$MULTILIB_OSDIRNAMES" ]; then
198 if [ "$dir" != .
]; then
199 gcc_multilib_dir
=`./xgcc -B./ $flags --print-multi-directory`
200 os_multilib_dir
=`./xgcc -B./ $flags --print-multi-os-directory`
202 gcc_multilib_sup
=`echo $gcc_multilib_dir | sed 's~^[^/]*/~~'`
203 os_multilib_base
=`echo $os_multilib_dir | sed -n "s~/${gcc_multilib_sup}\$~~p"`
204 if [ -z "$os_multilib_base" ]; then
205 libgcc_s_soname
=libgcc_s
206 libunwind_soname
=libunwind
207 if [ "$os_multilib_dir" != "." ]; then
208 shlib_dir_qual
="/$os_multilib_dir"
211 libgcc_s_soname
=libgcc_s_
`echo $gcc_multilib_sup | sed s,/,_,g`
212 libunwind_soname
=libunwind_
`echo $gcc_multilib_sup | sed s,/,_,g`
213 shlib_dir_qual
="/$os_multilib_base"
218 elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
219 libgcc_eh_a
=$dir/libgcc_eh.a
220 libgcc_s_so_base
=libgcc_s
221 libgcc_s_so
=${libgcc_s_so_base}${SHLIB_EXT}
222 libgcc_s_soname
=libgcc_s
223 if [ "$LIBUNWIND" ]; then
224 libunwind_so_base
=libunwind
225 libunwind_so
=${libunwind_so_base}${SHLIB_EXT}
226 libunwind_soname
=libunwind
237 echo \
# flags: $flags
238 echo \
# libgcc_a: $libgcc_a
239 echo \
# libgcov_a: $libgcov_a
240 echo \
# libgcc_eh_a: $libgcc_eh_a
241 echo \
# libunwind_a: $libunwind_a
243 echo \
# gcc_multilib_dir: $gcc_multilib_dir
244 echo \
# gcc_multilib_sup: $gcc_multilib_sup
245 echo \
# os_multilib_dir: $os_multilib_dir
246 echo \
# os_multilib_base: $os_multilib_base
247 echo \
# shlib_dir: $shlib_dir
248 echo \
# shlib_dir_qual: $shlib_dir_qual
250 echo \
# libgcc_s_so: $libgcc_s_so
251 echo \
# libgcc_s_so_base: $libgcc_s_so_base
252 echo \
# libgcc_s_soname: $libgcc_s_soname
254 echo \
# libunwind_so: $libunwind_so
255 echo \
# libunwind_so_base: $libunwind_so_base
256 echo \
# libunwind_soname: $libunwind_soname
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_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
304 if [ "$libgcc_s_so" ]; then
305 out
="libgcc/${dir}/${name}${objext}"
306 outS
="libgcc/${dir}/${name}_s${objext}"
308 echo $outS: $libgcc2_c_dep
309 echo " $gcc_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $outS
311 echo $out: $libgcc2_c_dep
312 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
313 -c '$(srcdir)/libgcc2.c' -o $out
316 echo $libgcc_s_so: $outS
317 if [ "$SHLIB_MKMAP" ]; then
318 echo libgcc
/${dir}/libgcc.map
: $outS
321 out
="libgcc/${dir}/${name}${objext}"
322 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
323 echo " $gcc_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $out
328 for name
in $LIB2FUNCS_ST; do
329 out
="libgcc/${dir}/${name}${objext}"
331 echo $out: $libgcc2_c_dep
332 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
333 -c '$(srcdir)/libgcc2.c' -o $out
334 echo ${dir}/libgcc.a
: $out
337 for name
in $LIB2_DIVMOD_FUNCS; do
338 if [ "$libgcc_s_so" ]; then
339 out
="libgcc/${dir}/${name}${objext}"
340 outS
="libgcc/${dir}/${name}_s${objext}"
342 echo $outS: $libgcc2_c_dep
343 echo " $gcc_compile" $flags -DL$name \
344 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
346 echo $out: $libgcc2_c_dep
347 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
348 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
351 echo $libgcc_s_so: $outS
352 if [ "$SHLIB_MKMAP" ]; then
353 echo libgcc
/${dir}/libgcc.map
: $outS
356 out
="libgcc/${dir}/${name}${objext}"
357 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
358 echo " $gcc_compile" $flags -DL$name \
359 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
365 # Build software floating point functions.
368 if [ "$FPBIT" ]; then
369 for name
in $FPBIT_FUNCS; do
370 if [ "$libgcc_s_so" ]; then
371 out
="libgcc/${dir}/${name}${objext}"
372 outS
="libgcc/${dir}/${name}_s${objext}"
374 echo $outS: $FPBIT $fpbit_c_dep
375 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
378 echo $out: $FPBIT $fpbit_c_dep
379 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
380 '$(vis_hide)' -c $FPBIT -o $out
383 echo $libgcc_s_so: $outS
384 if [ "$SHLIB_MKMAP" ]; then
385 echo libgcc
/${dir}/libgcc.map
: $outS
388 out
="libgcc/${dir}/${name}${objext}"
389 echo $out: $FPBIT $fpbit_c_dep
390 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
398 if [ "$DPBIT" ]; then
399 for name
in $DPBIT_FUNCS; do
400 if [ "$libgcc_s_so" ]; then
401 out
="libgcc/${dir}/${name}${objext}"
402 outS
="libgcc/${dir}/${name}_s${objext}"
404 echo $outS: $DPBIT $fpbit_c_dep
405 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
408 echo $out: $DPBIT $fpbit_c_dep
409 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
410 '$(vis_hide)' -c $DPBIT -o $out
413 echo $libgcc_s_so: $outS
414 if [ "$SHLIB_MKMAP" ]; then
415 echo libgcc
/${dir}/libgcc.map
: $outS
418 out
="libgcc/${dir}/${name}${objext}"
419 echo $out: $DPBIT $fpbit_c_dep
420 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
428 if [ "$TPBIT" ]; then
429 for name
in $TPBIT_FUNCS; do
430 if [ "$libgcc_s_so" ]; then
431 out
="libgcc/${dir}/${name}${objext}"
432 outS
="libgcc/${dir}/${name}_s${objext}"
434 echo $outS: $TPBIT $fpbit_c_dep
435 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
438 echo $out: $TPBIT $fpbit_c_dep
439 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
440 '$(vis_hide)' -c $TPBIT -o $out
443 echo $libgcc_s_so: $outS
444 if [ "$SHLIB_MKMAP" ]; then
445 echo libgcc
/${dir}/libgcc.map
: $outS
448 out
="libgcc/${dir}/${name}${objext}"
449 echo $out: $TPBIT $fpbit_c_dep
450 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
458 for file in $LIB2ADD; do
459 name
=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
460 oname
=`echo $name | sed -e 's,.*/,,'`
462 if [ "$libgcc_s_so" ]; then
463 out
="libgcc/${dir}/${oname}${objext}"
464 outS
="libgcc/${dir}/${oname}_s${objext}"
468 echo $outS: stmp-dirs
$file $libgcc_dep
469 echo " $gcc_compile" $flags -c $file -o $outS
471 echo $out: stmp-dirs
$file $libgcc_dep
472 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
476 outV
="libgcc/${dir}/${oname}.vis"
478 echo $outS: stmp-dirs
$file $libgcc_dep
479 echo " $gcc_compile" $flags -xassembler-with-cpp \
482 echo $out: stmp-dirs
$file $libgcc_dep $outV
483 echo " $gcc_compile" $flags -xassembler-with-cpp \
484 -include $outV -c $file -o $out
485 echo "${outV}: ${outS}; \$(gen-hide-list)"
489 echo "Unhandled extension: $file" >&2
495 echo $libgcc_s_so: $outS
496 if [ "$SHLIB_MKMAP" ]; then
497 echo libgcc
/${dir}/libgcc.map
: $outS
500 out
="libgcc/${dir}/${oname}${objext}"
503 echo $out: stmp-dirs
$file $libgcc_dep
504 echo " $gcc_compile" $flags -c $file -o $out
508 echo $out: stmp-dirs
$file $libgcc_dep
509 echo " $gcc_compile" $flags -xassembler-with-cpp \
514 echo "Unhandled extension: $file" >&2
524 for file in $LIB2ADD_ST; do
525 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
526 oname
=`echo $name | sed -e 's,.*/,,'`
527 out
="libgcc/${dir}/${oname}${objext}"
531 echo $out: stmp-dirs
$file $libgcc_dep
532 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
536 # We may have to compile it twice in order to establish the list
537 # of symbols to be marked hidden.
538 if [ "$libgcc_so" ]; then
539 outV
="libgcc/${dir}/${oname}.vis"
540 outT
="libgcc/${dir}/${oname}_t${objext}"
541 echo ${outT}: stmp-dirs
$file $libgcc_dep
542 echo " $gcc_compile" $flags -xassembler-with-cpp \
544 echo $out: stmp-dirs
$file $libgcc_dep $outV
545 echo " $gcc_compile" $flags -xassembler-with-cpp \
546 -include $outV -c $file -o $out
547 echo "${outV}: ${outT}; \$(gen-hide-list)"
549 echo $out: stmp-dirs
$file $libgcc_dep
550 echo " $gcc_compile" $flags -xassembler-with-cpp \
556 echo "Unhandled extension: $file" >&2
563 # If we don't have libgcc_eh.a, only LIB2ADDEH matters. If we do, only
564 # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter. (Usually all three are
565 # identical.) We do _not_ handle assembly files in this context.
567 if [ "$libgcc_eh_a" ]; then
568 for file in $LIB2ADDEHSTATIC; do
571 *) echo "Unhandled extension: $file">&2; exit 1 ;;
574 name
=`echo $file | sed -e 's/[.]c$//'`
575 oname
=`echo $name | sed -e 's,.*/,,'`
576 out
="libgcc/${dir}/${oname}${objext}"
578 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
579 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
580 echo $libgcc_eh_a: $out
583 for file in $LIB2ADDEHSHARED; do
586 *) echo "Unhandled extension: $file">&2; exit 1 ;;
589 name
=`echo $file | sed -e 's/[.]c$//'`
590 oname
=`echo $name | sed -e 's,.*/,,'`
591 out
="libgcc/${dir}/${oname}_s${objext}"
593 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
594 echo " $gcc_compile" $flags -fexceptions -c $file -o $out
595 echo $libgcc_s_so: $out
596 if [ "$SHLIB_MKMAP" ]; then
597 echo libgcc
/${dir}/libgcc.map
: $out
601 else # no libgcc_eh.a
602 for file in $LIB2ADDEH; do
605 *) echo "Unhandled extension: $file">&2; exit 1 ;;
608 name
=`echo $file | sed -e 's/[.]c$//'`
609 oname
=`echo $name | sed -e 's,.*/,,'`
610 out
="libgcc/${dir}/${oname}${objext}"
612 echo $out: stmp-dirs
$file $LIB2ADDEHDEP $libgcc_dep
613 echo " $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
618 # Again, this does not handle assembly.
619 if [ "$LIBUNWIND" ]; then
620 for file in $LIBUNWIND; do
623 *) echo "Unhandled extension: $file">&2; exit 1 ;;
626 name
=`echo $file | sed -e 's/[.]c$//'`
627 oname
=`echo $name | sed -e 's,.*/,,'`
629 if [ "$libunwind_so" ]; then
630 out
="libgcc/${dir}/${oname}${objext}"
631 outS
="libgcc/${dir}/${oname}_s${objext}"
633 echo $out: stmp-dirs
$file $LIBUNWINDDEP
634 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
636 echo $outS: stmp-dirs
$file $LIBUNWINDDEP
637 echo " $gcc_compile $flags -fexceptions -DSHARED -c $file -o $outS"
639 echo $libunwind_a: $out
640 echo $libunwind_so: $outS
642 out
="libgcc/${dir}/${oname}${objext}"
643 echo $out: stmp-dirs
$file $LIBUNWINDDEP
644 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
645 echo $libunwind_a: $out
651 # build libgcov components
653 for name
in $LIBGCOV; do
654 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
655 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
656 out
="libgcc/${dir}/${name}${objext}"
658 echo $out: $libgcov_c_dep
659 echo " $gcc_compile $flags -DL$name -c \$(srcdir)/libgcov.c -o $out"
660 echo $libgcov_a: $out
663 # EXTRA_MULTILIB_PARTS.
664 if [ -n "$EXTRA_MULTILIB_PARTS" ]; then
665 # Each of the EXTRA_MULTILIB_PARTS is built by recursive invocation
666 # of the parent Makefile. We must do this just once for each
667 # multilib, passing it all the EXTRA_MULTILIB_PARTS as
668 # simultaneous goal targets, so that rules which cannot execute
669 # simultaneously are properly serialized.
673 for f
in $EXTRA_MULTILIB_PARTS; do
676 *) out
=$dir/$f ; t
=$dir/ ;;
679 # Prevent `make' from interpreting $out as a macro assignment
680 *'$(EQ)'*) targ
="T_TARGET=$out T_TARGET" ;;
686 echo extra
$suffix: stmp-dirs
687 echo " $make_compile" \\
688 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
689 echo ' MULTILIB_CFLAGS="'$flags'"' T
=$t $extra
690 echo "all: extra$suffix"
692 # Make libunwind.so and libgcc_s.so depend on these, since they
693 # are likely to be implicitly used by the link process.
694 if [ "$libgcc_s_so" ]; then
695 echo "$libgcc_s_so: extra$suffix"
697 if [ "$libunwind_so" ]; then
698 echo "$libunwind_so: extra$suffix"
702 # Library build rules.
703 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
704 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
706 # Map-file generation.
707 if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
708 mapfile
="libgcc/${dir}/libgcc.map"
709 tmpmapfile
="libgcc/${dir}/tmp-libgcc.map"
710 # This uses a here document instead of echos because some shells
711 # will convert the \1 in the second sed command to a control-A.
712 # The behavior of here documents is more predictable.
715 ${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES
716 { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS \$(objects); echo %%; \\
717 cat $SHLIB_MAPFILES \\
718 | sed -e '/^[ ]*#/d' \\
719 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
720 | $gcc_compile $flags -E -xassembler-with-cpp -; \\
721 } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
723 $libgcc_s_so: ${mapfile}
729 # Each of these .a files depends on stmp-dirs. It would seem that
730 # this dependency is redundant, since each of the object files
731 # itself depends on stmp-dirs. However, it is possible that there
732 # are in fact no object files. In that case, the stmp-dirs
733 # dependency is required; the directory containing the archive must
734 # exist before the archive itself can be created.
736 echo "$libgcc_a: stmp-dirs"
737 echo " -rm -f $libgcc_a"
738 echo ' $(AR_CREATE_FOR_TARGET)' $libgcc_a '$(objects)'
739 echo ' $(RANLIB_FOR_TARGET)' $libgcc_a
740 echo "all: $libgcc_a"
743 echo "$libgcov_a: stmp-dirs"
744 echo " -rm -f $libgcov_a"
745 echo ' $(AR_CREATE_FOR_TARGET)' $libgcov_a '$(objects)'
746 echo ' $(RANLIB_FOR_TARGET)' $libgcov_a
747 echo "all: $libgcov_a"
749 # These libraries are not always built.
750 if [ "$libunwind_a" ]; then
752 echo "$libunwind_a: stmp-dirs"
753 echo " -rm -f $libunwind_a"
754 echo ' $(AR_CREATE_FOR_TARGET)' $libunwind_a '$(objects)'
755 echo ' $(RANLIB_FOR_TARGET)' $libunwind_a
756 echo "all: $libunwind_a"
759 if [ "$libgcc_eh_a" ]; then
761 echo "${dir}/libgcc_eh.a: stmp-dirs"
762 echo " -rm -f ${dir}/libgcc_eh.a"
763 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a
'$(objects)'
764 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
765 echo "all: $libgcc_eh_a"
769 if [ "$libgcc_s_so" ]; then
771 echo "$libgcc_s_so: stmp-dirs $libunwind_so"
772 echo " $SHLIB_LINK" \
773 |
sed -e "s%@multilib_flags@%$flags%g" \
774 -e "s%@multilib_dir@%$dir%g" \
775 -e "s%@shlib_objs@%\$(objects)%g" \
776 -e "s%@shlib_base_name@%$libgcc_s_so_base%g" \
777 -e "s%@shlib_so_name@%$libgcc_s_soname%g" \
778 -e "s%@shlib_map_file@%$mapfile%g" \
779 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
780 echo "all: $libgcc_s_so"
783 if [ "$libunwind_so" ]; then
785 echo "$libunwind_so: stmp-dirs"
786 echo " $SHLIBUNWIND_LINK" \
787 |
sed -e "s%@multilib_flags@%$flags%g" \
788 -e "s%@multilib_dir@%$dir%g" \
789 -e "s%@shlib_objs@%\$(objects)%g" \
790 -e "s%@shlib_base_name@%$libunwind_so_base%g" \
791 -e "s%@shlib_so_name@%$libunwind_soname%g" \
792 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
793 echo "all: $libunwind_so"
796 done # ml in MULTILIBS
799 echo "libgcc-stage-start:"
800 echo " for dir in \$(dirs); do \\"
801 echo " if [ -d \$(stage)/\$\$dir ]; then :; \\"
802 echo " else $mkinstalldirs \$(stage)/\$\$dir; fi; \\"
804 echo " -for dir in \$(dirs); do \\"
805 echo " mv \$\$dir/*${objext} \$(stage)/\$\$dir; \\"
806 echo " mv \$\$dir/*.vis \$(stage)/\$\$dir; \\"
807 echo " mv \$\$dir/*.map \$(stage)/\$\$dir; \\"
808 echo " test ! -f \$\$dir/libgcc.a || mv \$\$dir/lib* \$(stage)/\$\$dir; \\"
813 echo " for d in \$(dirs); do \\"
814 echo " if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
816 echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
820 for ml
in $MULTILIBS; do
821 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
822 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
823 if [ $dir != .
]; then
824 ldir
='$(DESTDIR)$(libsubdir)'/$dir
825 echo " if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
827 ldir
='$(DESTDIR)$(libsubdir)'
829 echo ' $(INSTALL_DATA)' ${dir}/libgcc.a
${ldir}/
830 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
831 echo ' $(INSTALL_DATA)' ${dir}/libgcov.a
${ldir}/
832 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
834 if [ "$SHLIB_LINK" ]; then
835 echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a
${ldir}/
836 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
838 if [ -z "$SHLIB_MULTILIB" ]; then
839 if [ "$dir" = .
]; then
840 shlib_base_name
=libgcc_s
841 shlibunwind_base_name
=libunwind
843 shlib_base_name
=libgcc_s_
`echo $dir | sed s,/,_,g`
844 shlibunwind_base_name
=libunwind_
`echo $dir | sed s,/,_,g`
846 shlib_so_name
="$shlib_base_name"
847 shlibunwind_so_name
="$shlibunwind_base_name"
850 if [ -n "$MULTILIB_OSDIRNAMES" ]; then
851 gcc_multilib_dir
=`./xgcc -B./ $flags --print-multi-directory`
852 os_multilib_dir
=`./xgcc -B./ $flags --print-multi-os-directory`
853 if [ "$dir" != .
]; then
856 gcc_multilib_sup
=`echo $gcc_multilib_dir | sed 's~^[^/]*/~~'`
857 os_multilib_base
=`echo $os_multilib_dir | sed -n "s~/${gcc_multilib_sup}\$~~p"`
858 if [ -z "$os_multilib_base" ]; then
859 shlib_so_name
=libgcc_s
860 shlibunwind_so_name
=libunwind
861 if [ "$os_multilib_dir" != "." ]; then
862 shlib_slibdir_qual
="/$os_multilib_dir"
865 shlib_so_name
=libgcc_s_
`echo $gcc_multilib_sup | sed s,/,_,g`
866 shlibunwind_so_name
=libunwind_
`echo $gcc_multilib_sup | sed s,/,_,g`
867 shlib_slibdir_qual
="/$os_multilib_base"
870 echo " $SHLIB_INSTALL" \
871 |
sed -e "s%@shlib_base_name@%$shlib_base_name%g" \
872 -e "s%@shlib_so_name@%$shlib_so_name%g" \
873 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
874 if [ "$LIBUNWIND" ]; then
875 echo " $SHLIBUNWIND_INSTALL" \
876 |
sed -e "s%@shlib_base_name@%$shlibunwind_base_name%g" \
877 -e "s%@shlib_so_name@%$shlibunwind_so_name%g" \
878 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
879 libunwinddir
='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
880 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a
${libunwinddir}/
881 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
883 elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
884 shlib_base_name
="libgcc_s";
885 echo " $SHLIB_INSTALL" \
886 |
sed -e "s%@shlib_base_name@%$shlib_base_name%g" \
887 -e "s%@shlib_so_name@%$shlib_base_name%g" \
888 -e "s%@shlib_slibdir_qual@%%g"
889 if [ "$LIBUNWIND" ]; then
890 echo " $SHLIBUNWIND_INSTALL" \
891 |
sed -e "s%@shlib_base_name@%$shlibunwind_base_name%g" \
892 -e "s%@shlib_so_name@%$shlibunwind_base_name%g" \
893 -e "s%@shlib_slibdir_qual@%%g"
894 libunwinddir
='$(DESTDIR)$(slibdir)'
895 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a
${libunwinddir}/
896 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
901 for f
in $EXTRA_MULTILIB_PARTS; do
902 for ml
in $MULTILIBS; do
903 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
904 if [ $dir != .
]; then
906 ldir
='$(DESTDIR)$(libsubdir)'/$dir
909 ldir
='$(DESTDIR)$(libsubdir)'
911 echo ' $(INSTALL_DATA)' $out $ldir/
915 echo '.PHONY: all install'