# Delete any leftover library objects.
if test "$build_old_libs" = yes; then
- removelist="$obj $libobj $lockfile"
+ removelist="$obj $libobj"
else
- removelist="$libobj $lockfile"
+ removelist="$libobj"
fi
$run $rm $removelist
# All platforms use -DPIC, to notify preprocessed assembler code.
command="$base_compile$pic_flag -DPIC $srcfile"
+ if test "$build_old_libs" = yes; then
+ lo_libobj="$libobj"
+ dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$libobj"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+
+ if test -d "$dir"; then
+ $show "$rm $libobj"
+ $run $rm $libobj
+ else
+ $show "$mkdir $dir"
+ $run $mkdir $dir
+ status=$?
+ if test $status -ne 0 && test ! -d $dir; then
+ exit $status
+ fi
+ fi
+ fi
if test "$compiler_o_lo" = yes; then
- command="$command -o $libobj"
output_obj="$libobj"
+ command="$command -o $output_obj"
elif test "$compiler_c_o" = yes; then
- command="$command -o $obj"
output_obj="$obj"
+ command="$command -o $output_obj"
fi
$show "$command"
fi
# Just move the object if needed, then go on to compile the next one
- if test "$compiler_o_lo" = no && test x"$output_obj" != x"$libobj"; then
+ if test x"$output_obj" != x"$libobj"; then
$show "$mv $output_obj $libobj"
if $run $mv $output_obj $libobj; then :
else
fi
# If we have no pic_flag, then copy the object into place and finish.
- if test -z "$pic_flag"; then
- $show $rm $obj
- $run $rm $obj
- $show "$LN_S $libobj $obj"
- if $run $LN_S $libobj $obj; then
+ if test -z "$pic_flag" && test "$build_old_libs" = yes; then
+ # Rename the .lo from within objdir to obj
+ if test -f $obj; then
+ $show $rm $obj
+ $run $rm $obj
+ fi
+
+ $show "$mv $libobj $obj"
+ if $run $mv $libobj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+
+ # Now arrange that obj and lo_libobj become the same file
+ $show "$LN_S $obj $lo_libobj"
+ if $run $LN_S $obj $lo_libobj; then
exit 0
else
error=$?
fi
# Just move the object if needed
- if test "$compiler_c_o" = no && test x"$output_obj" != x"$obj"; then
+ if test x"$output_obj" != x"$obj"; then
$show "$mv $output_obj $obj"
if $run $mv $output_obj $obj; then :
else
exit $error
fi
fi
+
+ # Create an invalid libtool object if no PIC, so that we do not
+ # accidentally link it into a program.
+ if test "$build_libtool_libs" != yes; then
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > \$libobj" || exit $?
+ else
+ # Move the .lo from within objdir
+ $show "$mv $libobj $lo_libobj"
+ if $run $mv $libobj $lo_libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
fi
# Unlock the critical section if it was locked
$rm "$lockfile"
fi
- # Create an invalid libtool object if no PIC, so that we do not
- # accidentally link it into a program.
- if test "$build_libtool_libs" != yes; then
- $show "echo timestamp > $libobj"
- $run eval "echo timestamp > \$libobj" || exit $?
- fi
-
exit 0
;;