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 libgcc1_objs
="$libgcc1_objs ${name}${objext}"
106 for name
in $LIB1FUNCS; do
107 out
="libgcc/${name}${objext}"
109 echo $out: $libgcc1_c_dep
110 if [ -z "@NO_MINUS_C_MINUS_O@" ]; then
111 echo " $oldcc_compile" -DL$name $flags -c '$(srcdir)/libgcc1.c' -o $out
113 echo " $oldcc_compile" -DL$name $flags -c '$(srcdir)/libgcc1.c'
114 echo " mv libgcc1${objext} $out"
117 libgcc1_objs
="$libgcc1_objs ${name}${objext}"
120 for file in $LIB1FUNCS_EXTRA; do
121 name
=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
122 out
="libgcc/${name}${objext}"
125 if [ ${name}.asm
= $file ]; then
126 echo " cp $file ${name}.s"
130 if [ -z "@NO_MINUS_C_MINUS_O@" ]; then
131 echo " $oldcc_compile" -c $file -o $out
133 echo " $oldcc_compile" -c $file
134 tmp
=`echo $file | sed -e 's/[.][cs]$/'${objext}/ -e 's,.*/,,'`
138 libgcc1_objs
="$libgcc1_objs ${name}${objext}"
142 echo "I'm confused about libgcc1." 1>&2
148 # Build libgcc2 components.
153 for name
in $LIB2FUNCS; do
154 for ml
in $MULTILIBS; do
155 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
156 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
157 out
="libgcc/${dir}/${name}${objext}"
159 echo $out: $libgcc2_c_dep
160 echo " $gcc_compile" '$(MAYBE_USE_COLLECT2)' $flags -DL$name \
161 -c '$(srcdir)/libgcc2.c' -o $out
163 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
166 for name
in $LIB2FUNCS_EH; do
167 for ml
in $MULTILIBS; do
168 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
169 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
170 out
="libgcc/${dir}/${name}${objext}"
172 echo $out: $libgcc2_c_dep
173 echo " $gcc_compile" '$(MAYBE_USE_COLLECT2)' -fexceptions \
174 $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $out
176 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
179 if [ "$FPBIT" ]; then
180 for name
in $FPBIT_FUNCS; do
181 for ml
in $MULTILIBS; do
182 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
183 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
184 out
="libgcc/${dir}/${name}${objext}"
186 echo $out: $FPBIT $fpbit_c_dep
187 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
190 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
194 if [ "$DPBIT" ]; then
195 for name
in $DPBIT_FUNCS; do
196 for ml
in $MULTILIBS; do
197 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
198 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
199 out
="libgcc/${dir}/${name}${objext}"
201 echo $out: $DPBIT $fpbit_c_dep
202 echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
205 libgcc2_objs
="$libgcc2_objs ${name}${objext}"
209 for file in $LIB2ADD; do
210 name
=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
211 oname
=`echo $name | sed -e 's,.*/,,'`
213 if [ ${name}.txt
= ${file} ]; then
217 lastout
="stmp-dirs $file"
218 for ml
in $MULTILIBS; do
219 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
220 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
221 out
="libgcc/${dir}/${f}"
223 # Depend on previous out to serialize all sub-makes of this
224 # target file. This because ./$f is used as a temporary in
225 # each case before being moved to libgcc/$dir/.
227 echo " $make_compile" \\
228 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
229 echo ' MULTILIB_CFLAGS="'$flags'"' $f
235 libgcc2_objs
="$libgcc2_objs $f"
238 for ml
in $MULTILIBS; do
239 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
240 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
241 out
="libgcc/${dir}/${oname}${objext}"
242 if [ ${name}.asm
= ${file} ]; then
243 flags
="$flags -xassembler-with-cpp"
246 echo $out: stmp-dirs
$file
247 echo " $gcc_compile" $flags -c $file -o $out
249 libgcc2_objs
="$libgcc2_objs ${oname}${objext}"
253 for ml
in $MULTILIBS; do
254 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
257 for o
in $libgcc1_objs; do
258 if [ "$LIBGCC1" = libgcc1-asm.a
]; then
259 libgcc_objs
="$libgcc_objs libgcc/${dir}/$o"
261 libgcc_objs
="$libgcc_objs libgcc/$o"
264 for o
in $libgcc2_objs; do
265 libgcc_objs
="$libgcc_objs libgcc/${dir}/$o"
269 echo "${dir}/libgcc.a: $libgcc_objs"
270 echo " -rm -rf ${dir}/libgcc.a"
271 echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a
$libgcc_objs
272 echo ' if $(RANLIB_TEST_FOR_TARGET) ; then' \\
273 echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc.a
';' \\
274 echo ' else true; fi;'
281 for ml
in $MULTILIBS; do
282 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
283 if [ $dir != .
]; then
284 dirs="$dirs ${dir} libgcc/${dir}"
286 all
="$all ${dir}/libgcc.a"
289 echo 'stmp-dirs: force'
290 echo ' for d in '"$dirs"'; do \'
291 echo ' if [ -d $
$d ]; then true
; else mkdir $
$d; fi \'
293 echo ' if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi'
295 for f
in $EXTRA_MULTILIB_PARTS; do
296 lastout
="stmp-dirs force"
297 for ml
in $MULTILIBS; do
298 dir
=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
299 flags
=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
302 # Depend on previous out to serialize all sub-makes of this
303 # target file. This because ./$f is used as a temporary in
304 # each case before being moved to libgcc/$dir/.
306 echo " $make_compile" \\
307 echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
308 echo ' MULTILIB_CFLAGS="'$flags'"' T
=t t
$f