50503ac83d
* configure.in (enable-shared): New. * Makefile.in (LIBGCC_DEPS): Depend on EXTRA_PARTS as well. (libgcc.mk): Pass SHLIB_LINK, SHLIB_LIBS, SHLIB_MULTILIB to mklibgcc. * mklibgcc.in: Use them to link shared a libgcc. * config/t-linux (SHLIB_LINK, SHLIB_LIBS): New. * config/alpha/t-ieee (SHLIB_MULTILIB): New. * config/mips/t-iris6 (SHLIB_LINK, SHLIB_LIBS): New. * config/sparc/t-sol2 (SHLIB_LINK, SHLIB_LIBS): New. * configure.in (alpha-osf*): Use t-osf and x-osf. * config/alpha/t-osf: New file. * config/alpha/t-osf4: New file. * config/alpha/x-osf: New file. * config/alpha/x-alpha: Remove file. From-SVN: r36715
383 lines
10 KiB
Bash
383 lines
10 KiB
Bash
#!/bin/sh
|
|
# Construct makefile for libgcc.
|
|
# Copyright (C) 2000 Free Software Foundation, Inc.
|
|
#
|
|
# This file is part of GNU CC.
|
|
|
|
# Arguments, taken from the environment, since there are a lot
|
|
# of them, and positional args becomes quite ugly.
|
|
#
|
|
# objext
|
|
# OLDCC
|
|
# LIBGCC1
|
|
# LIB1FUNCS
|
|
# LIB1ASMFUNCS
|
|
# LIB1FUNCS_EXTRA
|
|
# LIB2FUNCS
|
|
# LIB2FUNCS_EH
|
|
# LIB2ADD
|
|
# FPBIT
|
|
# FPBIT_FUNCS
|
|
# DPBIT
|
|
# DPBIT_FUNCS
|
|
# LIBGCC
|
|
# MULTILIBS
|
|
# EXTRA_MULTILIB_PARTS
|
|
# SHLIB_LINK
|
|
# SHLIB_LIBS
|
|
# SHLIB_MULTILIB
|
|
|
|
# Make needs VPATH to be literal.
|
|
echo 'srcdir = @srcdir@'
|
|
echo 'VPATH = @srcdir@'
|
|
echo 'EQ = ='
|
|
echo
|
|
echo 'force:'
|
|
echo
|
|
|
|
# Detect gcc as OLDCC. This indicates a target for which LIB1FUNCS
|
|
# is not needed. This is not quite the same as libgcc1.null, even
|
|
# on a target not using libgcc1-asm.a.
|
|
|
|
if [ "@build_canonical@" = "@target@" ]; then
|
|
tmp="tmp-$$.c"
|
|
cat > $tmp <<EOF
|
|
#ifdef __GNUC__
|
|
yes;
|
|
#endif
|
|
EOF
|
|
if $OLDCC -E $tmp | grep yes > /dev/null 2>&1; then
|
|
LIB1FUNCS=""
|
|
fi
|
|
rm -f $tmp
|
|
fi
|
|
|
|
# Disable SHLIB_LINK if shared libgcc not enabled.
|
|
if [ "@enable_shared@" = "no" ]; then
|
|
SHLIB_LINK=""
|
|
fi
|
|
|
|
# Build lines.
|
|
|
|
gcc_compile='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
|
|
oldcc_compile='$(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES)'
|
|
make_compile='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
|
|
AR_FOR_TARGET="$(AR_FOR_TARGET)" \
|
|
AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
|
|
AR_EXTRACT_FOR_TARGET="$(AR_EXTRACT_FOR_TARGET)" \
|
|
AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
|
|
CC="$(CC)" CFLAGS="$(CFLAGS)" \
|
|
HOST_PREFIX="$(HOST_PREFIX)" \
|
|
HOST_PREFIX_1="$(HOST_PREFIX_1)" \
|
|
LANGUAGES="$(LANGUAGES)"'
|
|
|
|
# Dependancies for libgcc1.c
|
|
libgcc1_c_dep='stmp-dirs $(srcdir)/libgcc1.c $(CONFIG_H)'
|
|
|
|
# Dependancies for libgcc2.c
|
|
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'
|
|
|
|
# Dependancies for fp-bit.c
|
|
fpbit_c_dep='stmp-dirs config.status tsystem.h'
|
|
|
|
#
|
|
# Build libgcc1 components.
|
|
#
|
|
|
|
libgcc1_objs=""
|
|
|
|
case X"$LIBGCC1" in
|
|
Xlibgcc1.null | X)
|
|
;;
|
|
|
|
Xlibgcc1.cross)
|
|
echo "You must find a way to make libgcc1 components yourself" 1>&2
|
|
;;
|
|
|
|
Xlibgcc1-asm.a)
|
|
for name in $LIB1ASMFUNCS; do
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
|
|
out="libgcc/${dir}/${name}${objext}"
|
|
|
|
echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
|
|
echo " $gcc_compile" $flags -DL$name -xassembler-with-cpp \
|
|
-c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
|
|
|
|
# Remove any objects from LIB2FUNCS that are defined as optimized
|
|
# assembly code in LIB1ASMFUNCS.
|
|
LIB2FUNCS=`echo $LIB2FUNCS | sed -e 's/^'$name' //' \
|
|
-e 's/ '$name' / /' \
|
|
-e 's/ '$name'$//'`
|
|
done
|
|
libgcc1_objs="$libgcc1_objs ${name}${objext}"
|
|
done
|
|
;;
|
|
|
|
Xlibgcc1.a)
|
|
for name in $LIB1FUNCS; do
|
|
out="libgcc/${name}${objext}"
|
|
|
|
echo $out: $libgcc1_c_dep
|
|
if [ -z "@NO_MINUS_C_MINUS_O@" ]; then
|
|
echo " $oldcc_compile" -DL$name $flags -c '$(srcdir)/libgcc1.c' -o $out
|
|
else
|
|
echo " $oldcc_compile" -DL$name $flags -c '$(srcdir)/libgcc1.c'
|
|
echo " mv libgcc1${objext} $out"
|
|
fi
|
|
|
|
libgcc1_objs="$libgcc1_objs ${name}${objext}"
|
|
done
|
|
|
|
for file in $LIB1FUNCS_EXTRA; do
|
|
name=`echo $file | sed -e 's/[.][cS]$//' -e 's/[.]asm$//'`
|
|
out="libgcc/${name}${objext}"
|
|
|
|
echo $out: $file
|
|
if [ ${name}.asm = $file ]; then
|
|
echo " cp $file ${name}.s"
|
|
file=${name}.s
|
|
fi
|
|
|
|
if [ -z "@NO_MINUS_C_MINUS_O@" ]; then
|
|
echo " $oldcc_compile" -c $file -o $out
|
|
else
|
|
echo " $oldcc_compile" -c $file
|
|
tmp=`echo $file | sed -e 's/[.][cs]$/'${objext}/ -e 's,.*/,,'`
|
|
echo " mv $tmp $out"
|
|
fi
|
|
|
|
libgcc1_objs="$libgcc1_objs ${name}${objext}"
|
|
done
|
|
;;
|
|
*)
|
|
echo "I'm confused about libgcc1." 1>&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
#
|
|
# Build libgcc2 components.
|
|
#
|
|
|
|
libgcc2_objs=""
|
|
|
|
for name in $LIB2FUNCS; do
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
|
|
out="libgcc/${dir}/${name}${objext}"
|
|
|
|
echo $out: $libgcc2_c_dep
|
|
echo " $gcc_compile" '$(MAYBE_USE_COLLECT2)' $flags -DL$name \
|
|
-c '$(srcdir)/libgcc2.c' -o $out
|
|
done
|
|
libgcc2_objs="$libgcc2_objs ${name}${objext}"
|
|
done
|
|
|
|
for name in $LIB2FUNCS_EH; do
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
|
|
out="libgcc/${dir}/${name}${objext}"
|
|
|
|
echo $out: $libgcc2_c_dep
|
|
echo " $gcc_compile" '$(MAYBE_USE_COLLECT2)' -fexceptions \
|
|
$flags -DL$name -c '$(srcdir)/libgcc2.c' -o $out
|
|
done
|
|
libgcc2_objs="$libgcc2_objs ${name}${objext}"
|
|
done
|
|
|
|
if [ "$FPBIT" ]; then
|
|
for name in $FPBIT_FUNCS; do
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
|
|
out="libgcc/${dir}/${name}${objext}"
|
|
|
|
echo $out: $FPBIT $fpbit_c_dep
|
|
echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
|
|
-c $FPBIT -o $out
|
|
done
|
|
libgcc2_objs="$libgcc2_objs ${name}${objext}"
|
|
done
|
|
fi
|
|
|
|
if [ "$DPBIT" ]; then
|
|
for name in $DPBIT_FUNCS; do
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
|
|
out="libgcc/${dir}/${name}${objext}"
|
|
|
|
echo $out: $DPBIT $fpbit_c_dep
|
|
echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
|
|
-c $DPBIT -o $out
|
|
done
|
|
libgcc2_objs="$libgcc2_objs ${name}${objext}"
|
|
done
|
|
fi
|
|
|
|
for file in $LIB2ADD; do
|
|
name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
|
|
oname=`echo $name | sed -e 's,.*/,,'`
|
|
|
|
if [ ${name}.txt = ${file} ]; then
|
|
fprime=`cat $file`
|
|
for f in $fprime; do
|
|
|
|
lastout="stmp-dirs $file"
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
|
|
out="libgcc/${dir}/${f}"
|
|
|
|
# Depend on previous out to serialize all sub-makes of this
|
|
# target file. This because ./$f is used as a temporary in
|
|
# each case before being moved to libgcc/$dir/.
|
|
echo $out: $lastout
|
|
echo " $make_compile" \\
|
|
echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
|
|
echo ' MULTILIB_CFLAGS="'$flags'"' $f
|
|
echo " mv $f $out"
|
|
|
|
lastout="$out"
|
|
done
|
|
|
|
libgcc2_objs="$libgcc2_objs $f"
|
|
done
|
|
else
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
|
|
out="libgcc/${dir}/${oname}${objext}"
|
|
if [ ${name}.asm = ${file} ]; then
|
|
flags="$flags -xassembler-with-cpp"
|
|
fi
|
|
|
|
echo $out: stmp-dirs $file
|
|
echo " $gcc_compile" $flags -c $file -o $out
|
|
done
|
|
libgcc2_objs="$libgcc2_objs ${oname}${objext}"
|
|
fi
|
|
done
|
|
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
|
|
|
|
libgcc_objs=""
|
|
for o in $libgcc1_objs; do
|
|
if [ "$LIBGCC1" = libgcc1-asm.a ]; then
|
|
libgcc_objs="$libgcc_objs libgcc/${dir}/$o"
|
|
else
|
|
libgcc_objs="$libgcc_objs libgcc/$o"
|
|
fi
|
|
done
|
|
for o in $libgcc2_objs; do
|
|
libgcc_objs="$libgcc_objs libgcc/${dir}/$o"
|
|
done
|
|
|
|
echo ""
|
|
echo "${dir}/libgcc.a: $libgcc_objs"
|
|
echo " -rm -rf ${dir}/libgcc.a"
|
|
echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a $libgcc_objs
|
|
echo ' if $(RANLIB_TEST_FOR_TARGET) ; then' \\
|
|
echo ' $(RANLIB_FOR_TARGET)' ${dir}/libgcc.a ';' \\
|
|
echo ' else true; fi;'
|
|
|
|
if [ "$SHLIB_LINK" ]; then
|
|
if [ -z "$SHLIB_MULTILIB" ]; then
|
|
if [ "$dir" = "." ]; then
|
|
shlib_base_name="libgcc_s";
|
|
else
|
|
shlib_base_name=libgcc_s_`echo $dir | sed s,/,_,g`
|
|
fi
|
|
echo ""
|
|
echo "${dir}/${shlib_base_name}.so: $libgcc_objs"
|
|
echo " $SHLIB_LINK $flags -o ${shlib_base_name}.so $libgcc_objs $SHLIB_LIBS" | sed "s/@shlib_base_name@/$shlib_base_name/g"
|
|
elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
|
|
shlib_base_name="libgcc_s";
|
|
echo ""
|
|
echo "${shlib_base_name}.so: $libgcc_objs"
|
|
echo " $SHLIB_LINK $flags -o ${shlib_base_name}.so $libgcc_objs $SHLIB_LIBS" | sed "s/@shlib_base_name@/$shlib_base_name/g"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
dirs=libgcc
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
if [ $dir != . ]; then
|
|
dirs="$dirs libgcc/${dir}"
|
|
fi
|
|
done
|
|
echo ''
|
|
echo 'libgcc-stage-start:'
|
|
echo ' for dir in '"${dirs}"'; do \'
|
|
echo ' if [ -d $(stage)/$$dir ]; then true; else mkdir $(stage)/$$dir; fi; \'
|
|
echo ' done'
|
|
echo ' -for dir in '"${dirs}"'; do \'
|
|
echo ' mv $$dir/*'"${objext}"' $(stage)/$$dir; \'
|
|
echo ' done'
|
|
|
|
echo ""
|
|
all=stmp-dirs
|
|
dirs=libgcc
|
|
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
if [ $dir != . ]; then
|
|
dirs="$dirs ${dir} libgcc/${dir}"
|
|
fi
|
|
all="$all ${dir}/libgcc.a"
|
|
if [ "$SHLIB_LINK" ]; then
|
|
if [ -z "$SHLIB_MULTILIB" ]; then
|
|
if [ "$dir" = "." ]; then
|
|
suff="";
|
|
else
|
|
suff=_`echo $dir | sed s,/,_,g`
|
|
fi
|
|
all="$all ${dir}/libgcc_s${suff}.so"
|
|
elif [ "$SHLIB_MULTILIB" = "$dir" ]; then
|
|
all="$all libgcc_s.so"
|
|
fi
|
|
if [ "$dir" = "." ]; then
|
|
suff="";
|
|
else
|
|
suff=_`echo $dir | sed s,/,_,g`
|
|
fi
|
|
fi
|
|
done
|
|
|
|
echo 'stmp-dirs: force'
|
|
echo ' for d in '"$dirs"'; do \'
|
|
echo ' if [ -d $$d ]; then true; else mkdir $$d; fi \'
|
|
echo ' done'
|
|
echo ' if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi'
|
|
|
|
for f in $EXTRA_MULTILIB_PARTS; do
|
|
lastout="stmp-dirs force"
|
|
for ml in $MULTILIBS; do
|
|
dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
|
|
flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
|
|
out="$dir/$f"
|
|
|
|
# Depend on previous out to serialize all sub-makes of this
|
|
# target file. This because ./$f is used as a temporary in
|
|
# each case before being moved to libgcc/$dir/.
|
|
echo $out: $lastout
|
|
echo " $make_compile" \\
|
|
echo ' LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)' $flags '" ' \\
|
|
echo ' MULTILIB_CFLAGS="'$flags'"' T=t t$f
|
|
echo " mv t$f $out"
|
|
|
|
all="$all $out"
|
|
lastout="$out"
|
|
done
|
|
done
|
|
|
|
echo ""
|
|
echo "all: $all"
|