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@'
35 # Detect gcc as OLDCC. This indicates a target for which LIB1FUNCS
36 # is not needed. This is not quite the same as libgcc1.null, even
37 # on a target not using libgcc1-asm.a.
39 if [ "@build_canonical@" = "@target@" ]; then
46 if $OLDCC -E $tmp |
grep yes > /dev
/null
2>&1; then
55 gcc_compile
='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
56 oldcc_compile
='$(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES)'
57 make_compile
='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
58 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
59 AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
60 AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
61 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
62 CC="$(CC)" CFLAGS="$(CFLAGS)" \
63 HOST_PREFIX="$(HOST_PREFIX)" \
64 HOST_PREFIX_1="$(HOST_PREFIX_1)" \
65 LANGUAGES="$(LANGUAGES)"'
67 # Dependancies for libgcc1.c
68 libgcc1_c_dep
='stmp-dirs $(srcdir)/libgcc1.c $(CONFIG_H)'
70 # Dependancies for libgcc2.c
71 libgcc2_c_dep
='stmp-dirs $(srcdir)/libgcc2.c $(CONFIG_H) $(MACHMODE_H) longlong.h frame.h gbl-ctors.h config.status stmp-int-hdrs tsystem.h'
73 # Dependancies for fp-bit.c
74 fpbit_c_dep
='stmp-dirs config.status tsystem.h'
77 # Build libgcc1 components.
87 echo "You must find a way to make libgcc1 components yourself" 1>&2
91 for name
in $LIB1ASMFUNCS; do
92 for ml
in $MULTILIBS; do
93 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
94 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
95 out
="libgcc/${dir}/${name}${objext}"
97 echo ${out}: stmp-dirs
'$(srcdir)/config/$(LIB1ASMSRC)'
98 echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
99 -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
101 # Remove any objects from LIB2FUNCS that are defined as optimized
102 # assembly code in LIB1ASMFUNCS.
103 LIB2FUNCS
=`echo $LIB2FUNCS | sed -e 's/^'$name' //' \
104 -e 's/ '$name' / /' \
107 libgcc1_objs
="$libgcc1_objs ${name}${objext}"
112 for name
in $LIB1FUNCS; do
113 out
="libgcc/${name}${objext}"
115 echo $out: $libgcc1_c_dep
116 if [ -z "@NO_MINUS_C_MINUS_O@" ]; then
117 echo " $oldcc_compile" -DL$name $flags -c '$(srcdir)/libgcc1.c' -o $out
119 echo " $oldcc_compile" -DL$name $flags -c '$(srcdir)/libgcc1.c'
120 echo " mv libgcc1${objext} $out"
123 libgcc1_objs
="$libgcc1_objs ${name}${objext}"
126 for file in $LIB1FUNCS_EXTRA; do
127 name
=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
128 out
="libgcc/${name}${objext}"
131 if [ ${name}.asm
= $file ]; then
132 echo " cp $file ${name}.s"
136 if [ -z "@NO_MINUS_C_MINUS_O@" ]; then
137 echo " $oldcc_compile" -c $file -o $out
139 echo " $oldcc_compile" -c $file
140 tmp
=`echo $file | sed -e 's/[.][cs]$/'${objext}/ -e 's,.*/,,'`
144 libgcc1_objs
="$libgcc1_objs ${name}${objext}"
148 echo "I'm confused about libgcc1." 1>&2
154 # Build libgcc2 components.
159 for name
in $LIB2FUNCS; do
160 for ml
in $MULTILIBS; do
161 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
162 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
163 out
="libgcc/${dir}/${name}${objext}"
165 echo $out: $libgcc2_c_dep
166 echo " $gcc_compile" '$(MAYBE_USE_COLLECT2)' $flags -DL$name \
167 -c '$(srcdir)/libgcc2.c' -o $out
169 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
172 for name
in $LIB2FUNCS_EH; do
173 for ml
in $MULTILIBS; do
174 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
175 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
176 out
="libgcc/${dir}/${name}${objext}"
178 echo $out: $libgcc2_c_dep
179 echo " $gcc_compile" '$(MAYBE_USE_COLLECT2)' -fexceptions \
180 $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $out
182 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
185 if [ "$FPBIT" ]; then
186 for name
in $FPBIT_FUNCS; do
187 for ml
in $MULTILIBS; do
188 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
189 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
190 out
="libgcc/${dir}/${name}${objext}"
192 echo $out: $FPBIT $fpbit_c_dep
193 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
196 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
200 if [ "$DPBIT" ]; then
201 for name
in $DPBIT_FUNCS; do
202 for ml
in $MULTILIBS; do
203 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
204 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
205 out
="libgcc/${dir}/${name}${objext}"
207 echo $out: $DPBIT $fpbit_c_dep
208 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
211 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
215 for file in $LIB2ADD; do
216 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
217 oname
=`echo $name | sed -e 's,.*/,,'`
219 if [ ${name}.txt
= ${file} ]; then
223 lastout
="stmp-dirs $file"
224 for ml
in $MULTILIBS; do
225 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
226 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
227 out
="libgcc/${dir}/${f}"
229 # Depend on previous out to serialize all sub-makes of this
230 # target file. This because ./$f is used as a temporary in
231 # each case before being moved to libgcc/$dir/.
233 echo " $make_compile" \\
234 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
235 echo ' MULTILIB_CFLAGS="'$flags'"' $f
241 libgcc2_objs
="$libgcc2_objs $f"
244 for ml
in $MULTILIBS; do
245 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
246 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
247 out
="libgcc/${dir}/${oname}${objext}"
248 if [ ${name}.asm
= ${file} ]; then
249 flags
="$flags -xassembler-with-cpp"
252 echo $out: stmp-dirs
$file
253 echo " $gcc_compile" $flags -c $file -o $out
255 libgcc2_objs
="$libgcc2_objs ${oname}${objext}"
259 for ml
in $MULTILIBS; do
260 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
263 for o
in $libgcc1_objs; do
264 if [ "$LIBGCC1" = libgcc1-asm.a
]; then
265 libgcc_objs
="$libgcc_objs libgcc/${dir}/$o"
267 libgcc_objs
="$libgcc_objs libgcc/$o"
270 for o
in $libgcc2_objs; do
271 libgcc_objs
="$libgcc_objs libgcc/${dir}/$o"
275 echo "${dir}/libgcc.a: $libgcc_objs"
276 echo " -rm -rf ${dir}/libgcc.a"
277 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a
$libgcc_objs
278 echo ' if $(RANLIB_TEST_FOR_TARGET) ; then' \\
279 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc.a
';' \\
280 echo ' else true; fi;'
287 for ml
in $MULTILIBS; do
288 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
289 if [ $dir != .
]; then
290 dirs="$dirs ${dir} libgcc/${dir}"
292 all
="$all ${dir}/libgcc.a"
295 echo 'stmp-dirs: force'
296 echo ' for d in '"$dirs"'; do \'
297 echo ' if [ -d $
$d ]; then true
; else mkdir $
$d; fi \'
299 echo ' if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi'
301 for f
in $EXTRA_MULTILIB_PARTS; do
302 lastout
="stmp-dirs force"
303 for ml
in $MULTILIBS; do
304 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
305 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
308 # Depend on previous out to serialize all sub-makes of this
309 # target file. This because ./$f is used as a temporary in
310 # each case before being moved to libgcc/$dir/.
312 echo " $make_compile" \\
313 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
314 echo ' MULTILIB_CFLAGS="'$flags'"' T
=t t
$f