* loop.c (scan_loop): Do not consider insns setting the frame
[official-gcc.git] / gcc / mklibgcc.in
blobaa61d41f4339a6f7394d74ddc04f7f8b1ef25744
1 #!/bin/sh
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.
10 # objext
11 # LIB1ASMFUNCS
12 # LIB2FUNCS_ST
13 # LIBGCOV
14 # LIB2ADD
15 # LIB2ADD_ST
16 # LIB2ADDEH
17 # LIB2ADDEHSTATIC
18 # LIB2ADDEHSHARED
19 # LIB2ADDEHDEP
20 # LIBUNWIND
21 # LIBUNWINDDEP
22 # SHLIBUNWIND_LINK
23 # SHLIBUNWIND_INSTALL
24 # FPBIT
25 # FPBIT_FUNCS
26 # LIB2_DIVMOD_FUNCS
27 # DPBIT
28 # DPBIT_FUNCS
29 # TPBIT
30 # TPBIT_FUNCS
31 # LIBGCC
32 # MULTILIBS
33 # EXTRA_MULTILIB_PARTS
34 # SHLIB_EXT
35 # SHLIB_LINK
36 # SHLIB_MKMAP
37 # SHLIB_MKMAP_OPTS
38 # SHLIB_MAPFILES
39 # SHLIB_NM_FLAGS
40 # SHLIB_INSTALL
41 # MULTILIB_OSDIRNAMES
42 # ASM_HIDDEN_OP
43 # GCC_FOR_TARGET
45 # Make needs VPATH to be literal.
46 echo 'srcdir = @srcdir@'
47 echo 'VPATH = @srcdir@'
48 echo 'EQ = ='
49 echo 'objects = $(filter %'$objext',$^)'
50 echo
51 echo '# Dependencies are accumulated as we go.'
52 echo 'all: stmp-dirs'
53 echo 'dirs = libgcc'
54 echo
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
66 _divxc3 _divtc3'
68 # Disable SHLIB_LINK if shared libgcc not enabled.
69 if [ "@enable_shared@" = "no" ]; then
70 SHLIB_LINK=""
73 # Build lines.
75 gcc_compile='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
76 gcc_s_compile="$gcc_compile -DSHARED"
77 make_compile='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
78 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
79 AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
80 AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
81 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
82 CC="$(CC)" CFLAGS="$(CFLAGS)" \
83 BUILD_PREFIX="$(BUILD_PREFIX)" \
84 BUILD_PREFIX_1="$(BUILD_PREFIX_1)" \
85 LANGUAGES="$(LANGUAGES)"'
87 # Generic dependencies for libgcc
88 libgcc_dep='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h'
90 # Dependencies for libgcc2.c
91 libgcc2_c_dep='stmp-dirs $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h gbl-ctors.h'" $libgcc_dep"
93 # Dependencies for libgcov.c
94 libgcov_c_dep='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"
96 # Dependencies for fp-bit.c
97 fpbit_c_dep='stmp-dirs config.status tsystem.h'
99 # Flag whether we need eh_dummy.c
100 need_eh_dummy=
102 if [ "$SHLIB_LINK" ]; then
103 # Test -fvisibility=hidden. We need both a -fvisibility=hidden on
104 # the command line, and a #define to prevent libgcc2.h etc from
105 # overriding that with #pragmas. The dance with @ is to prevent
106 # echo from seeing anything it might take for an option.
107 # echo turns the \$\$\$\$ into $$$$ and when make sees it it
108 # becomes $$ and the shell substitutes the pid. Makes for a
109 # slightly safer temp file.
110 echo "vis_hide := \$(strip \$(subst @,-,\\"
111 echo " \$(shell if echo 'void foo(void); void foo(void) {}' | \\"
112 echo " $gcc_compile -fvisibility=hidden -Werror \\"
113 echo " -c -xc - -o vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
114 echo " then echo @fvisibility=hidden @DHIDE_EXPORTS; \\"
115 echo " rm vis_temp_file\$\$\$\$.o 2> /dev/null; \\"
116 echo " fi)))"
117 echo
119 # If we have -fvisibility=hidden, then we need to generate hide
120 # lists for object files implemented in assembly. The default
121 # pseudo-op for this is ".hidden", but can be overridden with
122 # ASM_HIDDEN_OP.
123 [ "$ASM_HIDDEN_OP" ] || ASM_HIDDEN_OP=".hidden"
125 echo "ifneq (,\$(vis_hide))"
126 echo "define gen-hide-list"
127 echo "\$(NM_FOR_TARGET) ${SHLIB_NM_FLAGS} \$< | \\"
128 # non-GNU nm emits three fields even for undefined and typeless symbols,
129 # so explicitly omit them
130 echo " \$(AWK) 'NF == 3 && \$\$2 !~ /^[UN]\$\$/ { print \"\\t${ASM_HIDDEN_OP}\", \$\$3 }' > \$@T"
131 echo "mv -f \$@T \$@"
132 echo "endef"
133 echo "else"
134 echo "gen-hide-list = echo > \$@"
135 echo "endif"
136 echo
137 else
138 # It is too hard to guarantee that vis_hide and gen-hide-list will never
139 # be referenced if SHLIB_LINK is not set, so set them to the values they'd
140 # have if SHLIB_LINK were set and we didn't have visibility support.
141 echo "vis_hide ="
142 echo "gen-hide-list = echo > \$@"
145 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
146 # defined as optimized assembly code in LIB1ASMFUNCS.
147 for name in $LIB1ASMFUNCS; do
148 lib2funcs=`echo $lib2funcs | sed -e 's/^'$name' //' \
149 -e 's/ '$name' / /' \
150 -e 's/ '$name'$//'`
151 LIB2_DIVMOD_FUNCS=`echo $LIB2_DIVMOD_FUNCS | sed -e 's/^'$name' //' \
152 -e 's/ '$name' / /' \
153 -e 's/ '$name'$//'`
154 done
157 # Rules to generate object files.
160 for ml in $MULTILIBS; do
162 # Work out relevant parameters that depend only on the multilib.
163 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
164 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
165 shlib_slibdir_qual=
166 libgcc_a=$dir/libgcc.a
167 libgcov_a=$dir/libgcov.a
168 libgcc_eh_a=
169 libgcc_s_so=
170 libunwind_a=
171 libunwind_so=
173 if [ "$LIBUNWIND" ]; then
174 libunwind_a=$dir/libunwind.a
176 if [ "$SHLIB_LINK" ]; then
177 libgcc_eh_a=$dir/libgcc_eh.a
178 libgcc_s_so=$dir/libgcc_s${SHLIB_EXT}
179 if [ "$LIBUNWIND" ]; then
180 libunwind_so=$dir/libunwind${SHLIB_EXT}
182 os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
183 if [ "$os_multilib_dir" != . ]; then
184 shlib_slibdir_qual="/$os_multilib_dir"
188 libgcc_s_so_extra=
189 libunwind_so_extra=
191 echo
192 echo \#
193 echo \# ml: $ml
194 echo \# dir: $dir
195 echo \# flags: $flags
196 echo \# libgcc_a: $libgcc_a
197 echo \# libgcov_a: $libgcov_a
198 echo \# libgcc_eh_a: $libgcc_eh_a
199 echo \# libunwind_a: $libunwind_a
200 echo \#
201 echo \# shlib_slibdir_qual: $shlib_slibdir_qual
202 echo \# libgcc_s_so: $libgcc_s_so
203 echo \# libunwind_so: $libunwind_so
204 echo \#
205 echo
207 # Update list of directories.
208 if [ $dir != . ]; then
209 echo "dirs += ${dir} libgcc/${dir}"
210 echo
214 # Build libgcc1 components.
216 for name in $LIB1ASMFUNCS; do
217 if [ "$libgcc_s_so" ]; then
218 out="libgcc/${dir}/${name}${objext}"
219 outS="libgcc/${dir}/${name}_s${objext}"
220 outV="libgcc/${dir}/${name}.vis"
222 echo ${outS}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
223 echo " $gcc_s_compile" $flags -DL$name -xassembler-with-cpp \
224 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $outS
226 echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)' ${outV}
227 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
228 -c '$(srcdir)/config/$(LIB1ASMSRC)' -include $outV -o $out
230 echo "${outV}: ${outS}; \$(gen-hide-list)"
232 echo $libgcc_a: $out
233 echo $libgcc_s_so: $outS
234 if [ "$SHLIB_MKMAP" ]; then
235 echo libgcc/${dir}/libgcc.map: $outS
237 else
238 out="libgcc/${dir}/${name}${objext}"
239 echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
240 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
241 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
242 echo $libgcc_a: $out
244 done
247 # Build libgcc2 components.
250 for name in $lib2funcs; do
251 if [ "$libgcc_s_so" ]; then
252 out="libgcc/${dir}/${name}${objext}"
253 outS="libgcc/${dir}/${name}_s${objext}"
255 echo $outS: $libgcc2_c_dep
256 echo " $gcc_s_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' \
257 -o $outS
259 echo $out: $libgcc2_c_dep
260 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
261 -c '$(srcdir)/libgcc2.c' -o $out
263 echo $libgcc_a: $out
264 echo $libgcc_s_so: $outS
265 if [ "$SHLIB_MKMAP" ]; then
266 echo libgcc/${dir}/libgcc.map: $outS
268 else
269 out="libgcc/${dir}/${name}${objext}"
270 echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
271 echo " $gcc_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $out
272 echo $libgcc_a: $out
274 done
276 for name in $LIB2FUNCS_ST; do
277 out="libgcc/${dir}/${name}${objext}"
279 echo $out: $libgcc2_c_dep
280 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
281 -c '$(srcdir)/libgcc2.c' -o $out
282 echo ${dir}/libgcc.a: $out
283 done
285 for name in $LIB2_DIVMOD_FUNCS; do
286 if [ "$libgcc_s_so" ]; then
287 out="libgcc/${dir}/${name}${objext}"
288 outS="libgcc/${dir}/${name}_s${objext}"
290 echo $outS: $libgcc2_c_dep
291 echo " $gcc_s_compile" $flags -DL$name \
292 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
294 echo $out: $libgcc2_c_dep
295 echo " $gcc_compile" $flags -DL$name '$(vis_hide)' \
296 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
298 echo $libgcc_a: $out
299 echo $libgcc_s_so: $outS
300 if [ "$SHLIB_MKMAP" ]; then
301 echo libgcc/${dir}/libgcc.map: $outS
303 else
304 out="libgcc/${dir}/${name}${objext}"
305 echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
306 echo " $gcc_compile" $flags -DL$name \
307 -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $out
308 echo $libgcc_a: $out
310 done
313 # Build software floating point functions.
316 if [ "$FPBIT" ]; then
317 for name in $FPBIT_FUNCS; do
318 if [ "$libgcc_s_so" ]; then
319 out="libgcc/${dir}/${name}${objext}"
320 outS="libgcc/${dir}/${name}_s${objext}"
322 echo $outS: $FPBIT $fpbit_c_dep
323 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
324 -c $FPBIT -o $outS
326 echo $out: $FPBIT $fpbit_c_dep
327 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
328 '$(vis_hide)' -c $FPBIT -o $out
330 echo $libgcc_a: $out
331 echo $libgcc_s_so: $outS
332 if [ "$SHLIB_MKMAP" ]; then
333 echo libgcc/${dir}/libgcc.map: $outS
335 else
336 out="libgcc/${dir}/${name}${objext}"
337 echo $out: $FPBIT $fpbit_c_dep
338 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
339 -c $FPBIT -o $out
341 echo $libgcc_a: $out
343 done
346 if [ "$DPBIT" ]; then
347 for name in $DPBIT_FUNCS; do
348 if [ "$libgcc_s_so" ]; then
349 out="libgcc/${dir}/${name}${objext}"
350 outS="libgcc/${dir}/${name}_s${objext}"
352 echo $outS: $DPBIT $fpbit_c_dep
353 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
354 -c $DPBIT -o $outS
356 echo $out: $DPBIT $fpbit_c_dep
357 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
358 '$(vis_hide)' -c $DPBIT -o $out
360 echo $libgcc_a: $out
361 echo $libgcc_s_so: $outS
362 if [ "$SHLIB_MKMAP" ]; then
363 echo libgcc/${dir}/libgcc.map: $outS
365 else
366 out="libgcc/${dir}/${name}${objext}"
367 echo $out: $DPBIT $fpbit_c_dep
368 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
369 -c $DPBIT -o $out
371 echo $libgcc_a: $out
373 done
376 if [ "$TPBIT" ]; then
377 for name in $TPBIT_FUNCS; do
378 if [ "$libgcc_s_so" ]; then
379 out="libgcc/${dir}/${name}${objext}"
380 outS="libgcc/${dir}/${name}_s${objext}"
382 echo $outS: $TPBIT $fpbit_c_dep
383 echo " $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
384 -c $TPBIT -o $outS
386 echo $out: $TPBIT $fpbit_c_dep
387 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
388 '$(vis_hide)' -c $TPBIT -o $out
390 echo $libgcc_a: $out
391 echo $libgcc_s_so: $outS
392 if [ "$SHLIB_MKMAP" ]; then
393 echo libgcc/${dir}/libgcc.map: $outS
395 else
396 out="libgcc/${dir}/${name}${objext}"
397 echo $out: $TPBIT $fpbit_c_dep
398 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
399 -c $TPBIT -o $out
401 echo $libgcc_a: $out
403 done
406 for file in $LIB2ADD; do
407 name=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
408 oname=`echo $name | sed -e 's,.*/,,'`
410 if [ "$libgcc_s_so" ]; then
411 out="libgcc/${dir}/${oname}${objext}"
412 outS="libgcc/${dir}/${oname}_s${objext}"
414 case $file in
415 *.c)
416 echo $outS: stmp-dirs $file $libgcc_dep
417 echo " $gcc_s_compile" $flags -c $file -o $outS
419 echo $out: stmp-dirs $file $libgcc_dep
420 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
423 *.asm | *.S)
424 outV="libgcc/${dir}/${oname}.vis"
426 echo $outS: stmp-dirs $file $libgcc_dep
427 echo " $gcc_s_compile" $flags -xassembler-with-cpp \
428 -c $file -o $outS
430 echo $out: stmp-dirs $file $libgcc_dep $outV
431 echo " $gcc_compile" $flags -xassembler-with-cpp \
432 -include $outV -c $file -o $out
433 echo "${outV}: ${outS}; \$(gen-hide-list)"
437 echo "Unhandled extension: $file" >&2
438 exit 1
440 esac
442 echo $libgcc_a: $out
443 echo $libgcc_s_so: $outS
444 if [ "$SHLIB_MKMAP" ]; then
445 echo libgcc/${dir}/libgcc.map: $outS
447 else
448 out="libgcc/${dir}/${oname}${objext}"
449 case $file in
450 *.c)
451 echo $out: stmp-dirs $file $libgcc_dep
452 echo " $gcc_compile" $flags -c $file -o $out
455 *.asm | *.S)
456 echo $out: stmp-dirs $file $libgcc_dep
457 echo " $gcc_compile" $flags -xassembler-with-cpp \
458 -c $file -o $out
462 echo "Unhandled extension: $file" >&2
463 exit 1
465 esac
467 echo $libgcc_a: $out
469 done
472 for file in $LIB2ADD_ST; do
473 name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
474 oname=`echo $name | sed -e 's,.*/,,'`
475 out="libgcc/${dir}/${oname}${objext}"
477 case $file in
478 *.c)
479 echo $out: stmp-dirs $file $libgcc_dep
480 echo " $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
483 *.asm | *.S)
484 # We may have to compile it twice in order to establish the list
485 # of symbols to be marked hidden.
486 if [ "$libgcc_so" ]; then
487 outV="libgcc/${dir}/${oname}.vis"
488 outT="libgcc/${dir}/${oname}_t${objext}"
489 echo ${outT}: stmp-dirs $file $libgcc_dep
490 echo " $gcc_compile" $flags -xassembler-with-cpp \
491 -c $file -o ${outT}
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}: ${outT}; \$(gen-hide-list)"
496 else
497 echo $out: stmp-dirs $file $libgcc_dep
498 echo " $gcc_compile" $flags -xassembler-with-cpp \
499 -c $file -o $out
504 echo "Unhandled extension: $file" >&2
505 exit 1
507 esac
508 echo $libgcc_a: $out
509 done
511 # If we don't have libgcc_eh.a, only LIB2ADDEH matters. If we do, only
512 # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter. (Usually all three are
513 # identical.) We do _not_ handle assembly files in this context.
515 if [ "$libgcc_eh_a" ]; then
516 for file in $LIB2ADDEHSTATIC; do
517 case $file in
518 *.c) ;;
519 *) echo "Unhandled extension: $file">&2; exit 1 ;;
520 esac
522 name=`echo $file | sed -e 's/[.]c$//'`
523 oname=`echo $name | sed -e 's,.*/,,'`
524 out="libgcc/${dir}/${oname}${objext}"
526 echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
527 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
528 echo $libgcc_eh_a: $out
529 done
531 for file in $LIB2ADDEHSHARED; do
532 case $file in
533 *.c) ;;
534 *) echo "Unhandled extension: $file">&2; exit 1 ;;
535 esac
537 name=`echo $file | sed -e 's/[.]c$//'`
538 oname=`echo $name | sed -e 's,.*/,,'`
539 outS="libgcc/${dir}/${oname}_s${objext}"
541 echo $outS: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
542 echo " $gcc_s_compile" $flags -fexceptions -c $file -o $outS
543 echo $libgcc_s_so: $outS
544 if [ "$SHLIB_MKMAP" ]; then
545 echo libgcc/${dir}/libgcc.map: $outS
547 done
549 # If nothing went into libgcc_eh.a, create a dummy object -
550 # some linkers don't like totally empty archives.
551 if [ -z "$LIB2ADDEHSTATIC" ]; then
552 file=eh_dummy.c
553 out="libgcc/${dir}/eh_dummy${objext}"
554 need_eh_dummy=1
556 echo $out: stmp-dirs $file
557 echo " $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
558 echo $libgcc_eh_a: $out
562 else # no libgcc_eh.a
563 for file in $LIB2ADDEH; do
564 case $file in
565 *.c) ;;
566 *) echo "Unhandled extension: $file">&2; exit 1 ;;
567 esac
569 name=`echo $file | sed -e 's/[.]c$//'`
570 oname=`echo $name | sed -e 's,.*/,,'`
571 out="libgcc/${dir}/${oname}${objext}"
573 echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
574 echo " $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
575 echo $libgcc_a: $out
576 done
579 # Again, this does not handle assembly.
580 if [ "$LIBUNWIND" ]; then
581 for file in $LIBUNWIND; do
582 case $file in
583 *.c) ;;
584 *) echo "Unhandled extension: $file">&2; exit 1 ;;
585 esac
587 name=`echo $file | sed -e 's/[.]c$//'`
588 oname=`echo $name | sed -e 's,.*/,,'`
590 if [ "$libunwind_so" ]; then
591 out="libgcc/${dir}/${oname}${objext}"
592 outS="libgcc/${dir}/${oname}_s${objext}"
594 echo $out: stmp-dirs $file $LIBUNWINDDEP
595 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
597 echo $outS: stmp-dirs $file $LIBUNWINDDEP
598 echo " $gcc_s_compile $flags -fexceptions -c $file -o $outS"
600 echo $libunwind_a: $out
601 echo $libunwind_so: $outS
602 else
603 out="libgcc/${dir}/${oname}${objext}"
604 echo $out: stmp-dirs $file $LIBUNWINDDEP
605 echo " $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
606 echo $libunwind_a: $out
608 done
612 # build libgcov components
614 for name in $LIBGCOV; do
615 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
616 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
617 out="libgcc/${dir}/${name}${objext}"
619 echo $out: $libgcov_c_dep
620 echo " $gcc_compile $flags -DL$name -c \$(srcdir)/libgcov.c -o $out"
621 echo $libgcov_a: $out
622 done
624 # EXTRA_MULTILIB_PARTS.
625 if [ -n "$EXTRA_MULTILIB_PARTS" ]; then
626 # Each of the EXTRA_MULTILIB_PARTS is built by recursive invocation
627 # of the parent Makefile. We must do this just once for each
628 # multilib, passing it all the EXTRA_MULTILIB_PARTS as
629 # simultaneous goal targets, so that rules which cannot execute
630 # simultaneously are properly serialized.
632 extra=
633 echo
634 for f in $EXTRA_MULTILIB_PARTS; do
635 case $dir in
636 .) out=$f ; t= ;;
637 *) out=$dir/$f ; t=$dir/ ;;
638 esac
639 case $out in
640 # Prevent `make' from interpreting $out as a macro assignment
641 *'$(EQ)'*) targ="T_TARGET=$out T_TARGET" ;;
642 *) targ=$out ;;
643 esac
644 extra="$extra $targ"
645 done
647 if [ "$dir" = . ]; then
648 suffix=
649 else
650 suffix=`echo $dir | sed s,/,_,g`
652 echo extra$suffix: stmp-dirs
653 echo " $make_compile" \\
654 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
655 echo ' MULTILIB_CFLAGS="'$flags'"' T=$t $extra
656 echo "all: extra$suffix"
658 # Make libunwind.so and libgcc_s.so depend on these, since they
659 # are likely to be implicitly used by the link process.
660 if [ "$libgcc_s_so" ]; then
661 echo "$libgcc_s_so: extra$suffix"
663 if [ "$libunwind_so" ]; then
664 echo "$libunwind_so: extra$suffix"
668 # Library build rules.
669 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
670 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
672 # Map-file generation.
673 if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" ]; then
674 mapfile="libgcc/${dir}/libgcc.map"
675 tmpmapfile="libgcc/${dir}/tmp-libgcc.map"
676 # This uses a here document instead of echos because some shells
677 # will convert the \1 in the second sed command to a control-A.
678 # The behavior of here documents is more predictable.
679 cat <<EOF
681 ${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES
682 { \$(NM_FOR_TARGET) $SHLIB_NM_FLAGS \$(objects); echo %%; \\
683 cat $SHLIB_MAPFILES \\
684 | sed -e '/^[ ]*#/d' \\
685 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \\
686 | $gcc_compile $flags -E -xassembler-with-cpp -; \\
687 } | \$(AWK) -f $SHLIB_MKMAP $SHLIB_MKMAP_OPTS > ${tmpmapfile}
688 mv '$tmpmapfile' \$@
689 $libgcc_s_so: ${mapfile}
693 # Static libraries.
695 # Each of these .a files depends on stmp-dirs. It would seem that
696 # this dependency is redundant, since each of the object files
697 # itself depends on stmp-dirs. However, it is possible that there
698 # are in fact no object files. In that case, the stmp-dirs
699 # dependency is required; the directory containing the archive must
700 # exist before the archive itself can be created.
701 echo ""
702 echo "$libgcc_a: stmp-dirs"
703 echo " -rm -f $libgcc_a"
704 echo ' $(AR_CREATE_FOR_TARGET)' $libgcc_a '$(objects)'
705 echo ' $(RANLIB_FOR_TARGET)' $libgcc_a
706 echo "all: $libgcc_a"
708 echo ""
709 echo "$libgcov_a: stmp-dirs"
710 echo " -rm -f $libgcov_a"
711 echo ' $(AR_CREATE_FOR_TARGET)' $libgcov_a '$(objects)'
712 echo ' $(RANLIB_FOR_TARGET)' $libgcov_a
713 echo "all: $libgcov_a"
715 # These libraries are not always built.
716 if [ "$libunwind_a" ]; then
717 echo ""
718 echo "$libunwind_a: stmp-dirs"
719 echo " -rm -f $libunwind_a"
720 echo ' $(AR_CREATE_FOR_TARGET)' $libunwind_a '$(objects)'
721 echo ' $(RANLIB_FOR_TARGET)' $libunwind_a
722 echo "all: $libunwind_a"
725 if [ "$libgcc_eh_a" ]; then
726 echo ""
727 echo "${dir}/libgcc_eh.a: stmp-dirs"
728 echo " -rm -f ${dir}/libgcc_eh.a"
729 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a '$(objects)'
730 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc_eh.a
731 echo "all: $libgcc_eh_a"
734 # Shared libraries.
735 if [ "$libgcc_s_so" ]; then
736 echo ""
737 echo "$libgcc_s_so: stmp-dirs $libunwind_so"
738 echo " $SHLIB_LINK" \
739 | sed -e "s%@multilib_flags@%$flags%g" \
740 -e "s%@multilib_dir@%$dir%g" \
741 -e "s%@shlib_objs@%\$(objects)%g" \
742 -e "s%@shlib_base_name@%libgcc_s%g" \
743 -e "s%@shlib_map_file@%$mapfile%g" \
744 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
745 echo "all: $libgcc_s_so"
748 if [ "$libunwind_so" ]; then
749 echo ""
750 echo "$libunwind_so: stmp-dirs"
751 echo " $SHLIBUNWIND_LINK" \
752 | sed -e "s%@multilib_flags@%$flags%g" \
753 -e "s%@multilib_dir@%$dir%g" \
754 -e "s%@shlib_objs@%\$(objects)%g" \
755 -e "s%@shlib_base_name@%libunwind%g" \
756 -e "s%@shlib_slibdir_qual@%$shlib_dir_qual%g"
757 echo "all: $libunwind_so"
760 done # ml in MULTILIBS
762 echo
763 echo "libgcc-stage-start:"
764 echo " for dir in \$(dirs); do \\"
765 echo " if [ -d \$(stage)/\$\$dir ]; then :; \\"
766 echo " else $mkinstalldirs \$(stage)/\$\$dir; fi; \\"
767 echo " done"
768 echo " -for dir in \$(dirs); do \\"
769 echo " mv \$\$dir/*${objext} \$(stage)/\$\$dir; \\"
770 echo " mv \$\$dir/*.vis \$(stage)/\$\$dir; \\"
771 echo " mv \$\$dir/*.map \$(stage)/\$\$dir; \\"
772 echo " test ! -f \$\$dir/libgcc.a || mv \$\$dir/lib* \$(stage)/\$\$dir; \\"
773 echo " done"
775 echo
776 echo "stmp-dirs:"
777 echo " for d in \$(dirs); do \\"
778 echo " if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
779 echo " done"
780 echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
782 if [ "$need_eh_dummy" ]; then
783 echo "eh_dummy.c:"
784 echo " echo 'struct eh_dummy;' > \$@"
787 echo ""
788 echo "install: all"
789 for ml in $MULTILIBS; do
790 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
791 flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
792 if [ $dir != . ]; then
793 ldir='$(DESTDIR)$(libsubdir)'/$dir
794 echo " if [ -d $ldir ]; then true; else $mkinstalldirs $ldir; chmod a+rx $ldir; fi;"
795 else
796 ldir='$(DESTDIR)$(libsubdir)'
798 echo ' $(INSTALL_DATA)' ${dir}/libgcc.a ${ldir}/
799 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
800 echo ' $(INSTALL_DATA)' ${dir}/libgcov.a ${ldir}/
801 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcov.a
803 if [ "$SHLIB_LINK" ]; then
804 echo ' $(INSTALL_DATA)' ${dir}/libgcc_eh.a ${ldir}/
805 echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
807 shlib_slibdir_qual=
808 os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
809 if [ "$os_multilib_dir" != . ]; then
810 shlib_slibdir_qual="/$os_multilib_dir"
812 echo " $SHLIB_INSTALL" \
813 | sed -e "s%@multilib_dir@%$dir%g" \
814 -e "s%@shlib_base_name@%libgcc_s%g" \
815 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
816 if [ "$LIBUNWIND" ]; then
817 echo " $SHLIBUNWIND_INSTALL" \
818 | sed -e "s%@multilib_dir@%$dir%g" \
819 -e "s%@shlib_base_name@%libunwind%g" \
820 -e "s%@shlib_slibdir_qual@%$shlib_slibdir_qual%g"
821 libunwinddir='$(DESTDIR)$(slibdir)$(shlib_slibdir_qual)/$(shlib_dir)'
822 echo ' $(INSTALL_DATA)' ${dir}/libunwind.a ${libunwinddir}/
823 echo ' $(RANLIB_FOR_TARGET)' ${libunwinddir}/libunwind.a
826 done
827 for f in $EXTRA_MULTILIB_PARTS; do
828 for ml in $MULTILIBS; do
829 dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
830 if [ $dir != . ]; then
831 out=${dir}/$f
832 ldir='$(DESTDIR)$(libsubdir)'/$dir
833 else
834 out=$f
835 ldir='$(DESTDIR)$(libsubdir)'
837 echo ' $(INSTALL_DATA)' $out $ldir/
838 done
839 done
841 echo '.PHONY: all install'