If a file declared .INTERMEDIATE already exists before make starts, we
authorPaul Smith <psmith@gnu.org>
Fri, 9 Apr 1999 05:57:35 +0000 (05:57 +0000)
committerPaul Smith <psmith@gnu.org>
Fri, 9 Apr 1999 05:57:35 +0000 (05:57 +0000)
won't delete it--this is how normal intermediate files behave, too.

ChangeLog
remake.c

index fcb7aba2d255568628079457aa90c641e3c91663..e951eaf06e4f9c0b6a90ef7d14376b0e727147eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+1999-04-03  Paul D. Smith  <psmith@gnu.org>
+
+       * remake.c (f_mtime): If: a) we found a file and b) we didn't
+       create it and c) it's not marked as an implicit target and d) it
+       is marked as an intermediate target, then it was so marked due to
+       an .INTERMEDIATE special target, but it already existed in the
+       directory.  In this case, unset the intermediate flag so we won't
+       delete it when make is done.  It feels like it would be cleaner to
+       put this check in update_file_1() but I worry it'll get missed...
+
 1999-04-01  Paul D. Smith  <psmith@gnu.org>
 
        * job.c (construct_command_argv_internal): Use bcopy() to copy
index b8b5c7fc17ea5cdcf038b24a6969e36eef0be727..674f7efe5bd48fcf1502dde7b8694a2c05b4de42 100644 (file)
--- a/remake.c
+++ b/remake.c
@@ -1140,11 +1140,22 @@ f_mtime (file, search)
   /* Store the mtime into all the entries for this file.  */
   if (file->double_colon)
     file = file->double_colon;
+
   do
     {
+      /* If this file is not implicit but it is intermediate then it was
+        made so by the .INTERMEDIATE target.  If this file has never
+        been built by us but was found now, it existed before make
+        started.  So, turn off the intermediate bit so make doesn't
+        delete it, since it didn't create it.  */
+      if (mtime != (FILE_TIMESTAMP)-1 && file->command_state == cs_not_started
+         && !file->tried_implicit && file->intermediate)
+       file->intermediate = 0;
+
       file->last_mtime = mtime;
       file = file->prev;
-    } while (file != 0);
+    }
+  while (file != 0);
 
   return mtime;
 }