]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltmain.in: Output libobj file in a temporary file, then
authorAlexandre Oliva <oliva@lsd.ic.unicamp.br>
Fri, 26 May 2000 05:35:00 +0000 (05:35 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Fri, 26 May 2000 05:35:00 +0000 (05:35 +0000)
rename it.

ChangeLog
ltmain.in

index e2f537f7ffe8bd42b46357ca7154229c58c688d2..54c4cfaa4a110f24011b64a371bb62e6e5e3133b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2000-05-26  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
 
+       * ltmain.in: Output libobj file in a temporary file, then
+       rename it.
+
        * ltconfig.in: Make the output script executable after updating
        available_tags.
 
index 09caebd7462f1fa0ccc3b10682679c380f49e8b4..a754faf1ae04ec1d6b4cfde94521d55f419291e5 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -519,9 +519,9 @@ if test -z "$show_help"; then
 
     # 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
@@ -546,6 +546,7 @@ if test -z "$show_help"; then
       removelist="$removelist $output_obj $lockfile"
       trap "$run $rm $removelist; exit 1" 1 2 15
     else
+      output_obj=
       need_locks=no
       lockfile=
     fi
@@ -580,11 +581,11 @@ compiler."
       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
 #
@@ -616,19 +617,13 @@ EOF
         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
@@ -657,7 +652,7 @@ compiler."
       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
@@ -667,12 +662,18 @@ compiler."
        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
@@ -689,20 +690,11 @@ 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
@@ -731,7 +723,7 @@ compiler."
       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
@@ -740,16 +732,26 @@ compiler."
          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"