# Delete any leftover library objects.
if test "$build_old_libs" = yes; then
- removelist="$obj $lobj $libobj"
+ removelist="$obj $lobj $libobj ${libobj}T"
else
- removelist="$lobj $libobj"
+ removelist="$lobj $libobj ${libobj}T"
fi
$run $rm $removelist
removelist="$removelist $output_obj $lockfile"
trap "$run $rm $removelist; exit 1" 1 2 15
else
+ output_obj=
need_locks=no
lockfile=
fi
eval srcfile=\"$fix_srcfile_path\"
fi
- $run $rm "$libobj"
+ $run $rm "$libobj" "${libobj}T"
# Create a libtool object file (analogous to a ".la" file),
# but don't create it if we're doing a dry run.
- test -z "$run" && cat > $libobj <<EOF
+ test -z "$run" && cat > ${libobj}T <<EOF
# $libobj - a libtool object file
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
#
fi
fi
- # Place PIC objects in $objdir
- output_obj=$lobj
- command="$command -o $output_obj"
-
- $run $rm "$output_obj"
-
- # Append the name of the PIC object to the libtool object file.
- test -z "$run" && cat >> $libobj <<EOF
-pic_object='$objdir/$objname'
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ command="$command -o $lobj"
+ fi
-EOF
+ $run $rm "$lobj" "$output_obj"
- $run $rm "$output_obj"
$show "$command"
if $run eval "$command"; then :
else
fi
# Just move the object if needed, then go on to compile the next one
- if test x"$output_obj" != x"$lobj"; then
+ if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then
$show "$mv $output_obj $lobj"
if $run $mv $output_obj $lobj; then :
else
fi
fi
+ # Append the name of the PIC object to the libtool object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
# Allow error messages only from the first compilation.
suppress_output=' >/dev/null 2>&1'
else
# No PIC object so indicate it doesn't exist in the libtool
# object file.
- test -z "$run" && cat >> $libobj <<EOF
+ test -z "$run" && cat >> ${libobj}T <<EOF
pic_object=none
EOF
fi
if test "$compiler_c_o" = yes; then
command="$command -o $obj"
- output_obj="$obj"
fi
- # Append the name of the non-PIC object the libtool object file.
- # Only append if the libtool object file exists.
- test -z "$run" && cat >> $libobj <<EOF
-# Name of the non-PIC object.
-non_pic_object='$objname'
-
-EOF
-
# Suppress compiler output if we already did a PIC compilation.
command="$command$suppress_output"
- $run $rm "$output_obj"
+ $run $rm "$obj $output_obj"
$show "$command"
if $run eval "$command"; then :
else
fi
# Just move the object if needed
- if test x"$output_obj" != x"$obj"; then
+ if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
$show "$mv $output_obj $obj"
if $run $mv $output_obj $obj; then :
else
exit $error
fi
fi
+
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
else
# Append the name of the non-PIC object the libtool object file.
# Only append if the libtool object file exists.
- test -z "$run" && cat >> $libobj <<EOF
+ test -z "$run" && cat >> ${libobj}T <<EOF
# Name of the non-PIC object.
non_pic_object=none
EOF
fi
+ $run $mv "${libobj}T" "${libobj}"
+
# Unlock the critical section if it was locked
if test "$need_locks" != no; then
$rm "$lockfile"