2 # Construct makefile for libgcc.
3 # Copyright (C) 2000 Free Software Foundation, Inc.
5 # This file is part of GNU CC.
7 # Arguments, taken from the environment, since there are a lot
8 # of them, and positional args becomes quite ugly.
25 # EXTRA_MULTILIB_PARTS
27 # Make needs VPATH to be literal.
28 echo 'srcdir = @srcdir@'
29 echo 'VPATH = @srcdir@'
32 # Detect gcc as OLDCC. This indicates a target for which LIB1FUNCS
33 # is not needed. This is not quite the same as libgcc1.null, even
34 # on a target not using libgcc1-asm.a.
36 if [ "@build_canonical@" = "@target@" ]; then
43 if $OLDCC -E $tmp |
grep yes > /dev
/null
2>&1; then
59 echo ' $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)' \
60 $flags -c $src -o $dst
63 emit_oldcc_compile
() {
68 if [ -z "@NO_MINUS_C_MINUS_O@" ]; then
69 echo ' $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES)' \
70 $flags -c $src -o $dst
72 echo ' $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES)'
74 tmp
=`echo $src | sed -e 's/[.]c$/'${objext}/ -e 's,.*/,,'`
83 if [ "$1" = "T=t" ]; then
84 tmp
="T=t"; tgt
="t$tgt"; shift
88 echo ' $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)"' \\
89 echo ' AR_FOR_TARGET="$(AR_FOR_TARGET)"' \\
90 echo ' AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)"' \\
91 echo ' AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)"' \\
92 echo ' AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)"' \\
93 echo ' CC="$(CC)" CFLAGS="$(CFLAGS)"' \\
94 echo ' HOST_PREFIX="$(HOST_PREFIX)"' \\
95 echo ' HOST_PREFIX_1="$(HOST_PREFIX_1)"' \\
96 echo ' LANGUAGES="$(LANGUAGES)"' \\
97 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
98 echo ' MULTILIB_CFLAGS="'$flags'"' $tmp $tgt
99 echo " mv ${tgt} ${dst}"
102 # Dependancies for libgcc1.c
103 libgcc1_c_dep
='$(srcdir)/libgcc1.c $(CONFIG_H)'
105 # Dependancies for libgcc2.c
106 libgcc2_c_dep
='$(srcdir)/libgcc2.c $(CONFIG_H) $(MACHMODE_H) longlong.h frame.h gbl-ctors.h config.status stmp-int-hdrs tsystem.h'
108 # Dependancies for fp-bit.c
109 fpbit_c_dep
='$(srcdir)/config/fp-bit.c config.status tsystem.h'
112 # Build libgcc1 components.
122 echo "You must find a way to make libgcc1 components yourself" 1>&2
126 for name
in $LIB1ASMFUNCS; do
127 for ml
in $MULTILIBS; do
128 dir
=`echo ${ml} | sed -e 's/;.*$//'`
129 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
130 out
="libgcc/${dir}/${name}${objext}"
132 echo ${out}: '$(srcdir)/config/$(LIB1ASMSRC)'
133 emit_gcc_compile
$out '$(srcdir)/config/$(LIB1ASMSRC)' \
134 $flags -DL$name -xassembler-with-cpp
136 libgcc1_objs
="$libgcc1_objs ${name}${objext}"
141 for name
in $LIB1FUNCS; do
142 out
="libgcc/${name}${objext}"
144 echo $out: $libgcc1_c_dep
145 emit_oldcc_compile
$out '$(srcdir)/libgcc1.c' -DL${name}
146 libgcc1_objs
="$libgcc1_objs ${name}${objext}"
149 for file in $LIB1FUNCS_EXTRA; do
150 name
=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
151 out
="libgcc/${name}${objext}"
154 if [ ${name}.asm
= $file ]; then
155 echo " cp $file ${name}.s"
158 emit_oldcc_compile
$out $file
159 libgcc1_objs
="$libgcc1_objs ${name}${objext}"
163 echo "I'm confused about libgcc1." 1>&2
169 # Build libgcc2 components.
174 for name
in $LIB2FUNCS; do
175 for ml
in $MULTILIBS; do
176 dir
=`echo ${ml} | sed -e 's/;.*$//'`
177 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
178 out
="libgcc/${dir}/${name}${objext}"
180 echo $out: $libgcc2_c_dep
181 emit_gcc_compile
$out '$(srcdir)/libgcc2.c' '$(MAYBE_USE_COLLECT2)' \
184 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
187 for name
in $LIB2FUNCS_EH; do
188 for ml
in $MULTILIBS; do
189 dir
=`echo ${ml} | sed -e 's/;.*$//'`
190 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
191 out
="libgcc/${dir}/${name}${objext}"
193 echo $out: $libgcc2_c_dep
194 emit_gcc_compile
$out '$(srcdir)/libgcc2.c' '$(MAYBE_USE_COLLECT2)' \
195 -fexceptions $flags -DL$name
197 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
200 if [ "$FPBIT" ]; then
201 for name
in $FPBIT_FUNCS; do
202 for ml
in $MULTILIBS; do
203 dir
=`echo ${ml} | sed -e 's/;.*$//'`
204 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
205 out
="libgcc/${dir}/${name}${objext}"
207 echo $out: $fpbit_c_dep
208 emit_gcc_compile
$out '$(srcdir)/config/fp-bit.c' \
209 -DFLOAT -DFINE_GRAINED_LIBRARIES $flags -DL$name
211 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
215 if [ "$DPBIT" ]; then
216 for name
in $DPBIT_FUNCS; do
217 for ml
in $MULTILIBS; do
218 dir
=`echo ${ml} | sed -e 's/;.*$//'`
219 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
220 out
="libgcc/${dir}/${name}${objext}"
222 echo $out: $fpbit_c_dep
223 emit_gcc_compile
$out '$(srcdir)/config/fp-bit.c' \
224 -DFINE_GRAINED_LIBRARIES $flags -DL$name
226 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
230 for file in $LIB2ADD; do
231 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
232 oname
=`echo $name | sed -e 's,.*/,,'`
234 if [ ${name}.txt
= ${file} ]; then
239 for ml
in $MULTILIBS; do
240 dir
=`echo ${ml} | sed -e 's/;.*$//'`
241 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
242 out
="libgcc/${dir}/${f}"
244 # Depend on previous out to serialize all sub-makes of this
245 # target file. This because ./$f is used as a temporary in
246 # each case before being moved to libgcc/$dir/.
248 emit_make_compile
$out $f $flags
253 libgcc2_objs
="$libgcc2_objs $f"
256 for ml
in $MULTILIBS; do
257 dir
=`echo ${ml} | sed -e 's/;.*$//'`
258 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
259 out
="libgcc/${dir}/${oname}${objext}"
260 if [ ${name}.asm
= ${file} ]; then
261 flags
="$flags -xassembler-with-cpp"
265 emit_gcc_compile
$out $file $flags
267 libgcc2_objs
="$libgcc2_objs ${oname}${objext}"
271 for ml
in $MULTILIBS; do
272 dir
=`echo ${ml} | sed -e 's/;.*$//'`
275 for o
in $libgcc1_objs; do
276 if [ "$LIBGCC1" = libgcc1-asm.a
]; then
277 libgcc_objs
="$libgcc_objs libgcc/${dir}/$o"
279 libgcc_objs
="$libgcc_objs libgcc/$o"
282 for o
in $libgcc2_objs; do
283 libgcc_objs
="$libgcc_objs libgcc/${dir}/$o"
287 echo "${dir}/libgcc.a: $libgcc_objs"
288 echo " -rm -rf ${dir}/libgcc.a"
289 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a
$libgcc_objs
290 echo ' if $(RANLIB_TEST_FOR_TARGET) ; then' \\
291 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc.a
';' \\
292 echo ' else true; fi;'
298 for ml
in $MULTILIBS; do
299 dir
=`echo ${ml} | sed -e 's/;.*$//'`
300 if [ $dir = .
]; then
301 echo "libgcc:; mkdir libgcc"
304 echo "${dir}:; mkdir ${dir}"
305 echo "libgcc/${dir}:; mkdir libgcc/${dir}"
306 all
="$all libgcc/${dir} ${dir}"
308 all
="$all ${dir}/libgcc.a"
311 for f
in $EXTRA_MULTILIB_PARTS; do
313 for ml
in $MULTILIBS; do
314 dir
=`echo ${ml} | sed -e 's/;.*$//'`
315 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
318 # Depend on previous out to serialize all sub-makes of this
319 # target file. This because ./$f is used as a temporary in
320 # each case before being moved to libgcc/$dir/.
322 emit_make_compile
$out $f T
=t
$flags