summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1996-03-20 00:56:52 +0000
committerRoland McGrath <roland@redhat.com>1996-03-20 00:56:52 +0000
commit8b2aca5930b9c761cfcd843411c2935bb0e8bf32 (patch)
tree7a7af6de15cea0b7b585d45569ca804d0051dfd9 /file.c
parentb8ea37e31cc6b81a77743383641b48c1158cc94a (diff)
downloadgunmake-8b2aca5930b9c761cfcd843411c2935bb0e8bf32.tar.gz
Sun Jul 30 00:49:53 1995 Richard Stallman <rms@mole.gnu.ai.mit.edu>
* file.h (struct file): New field `secondary'. * file.c (snap_deps): Check for .INTERMEDIATE and .SECONDARY. (remove_intermediates): Don't delete .SECONDARY files.
Diffstat (limited to 'file.c')
-rw-r--r--file.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/file.c b/file.c
index 82e7442..f81c9b9 100644
--- a/file.c
+++ b/file.c
@@ -303,7 +303,8 @@ remove_intermediates (sig)
doneany = 0;
for (i = 0; i < FILE_BUCKETS; ++i)
for (f = files[i]; f != 0; f = f->next)
- if (f->intermediate && (f->dontcare || !f->precious))
+ if (f->intermediate && (f->dontcare || !f->precious)
+ && !f->secondary)
{
int status;
if (f->update_status == -1)
@@ -349,7 +350,8 @@ remove_intermediates (sig)
/* For each dependency of each file, make the `struct dep' point
at the appropriate `struct file' (which may have to be created).
- Also mark the files depended on by .PRECIOUS and .PHONY. */
+ Also mark the files depended on by .PRECIOUS, .PHONY, .SILENT,
+ and various other special targets. */
void
snap_deps ()
@@ -387,6 +389,41 @@ snap_deps ()
f2->last_mtime = (time_t) -1;
}
+ for (f = lookup_file (".INTERMEDIATE"); f != 0; f = f->prev)
+ {
+ /* .INTERMEDIATE with deps listed
+ marks those deps as intermediate files. */
+ for (d = f->deps; d != 0; d = d->next)
+ for (f2 = d->file; f2 != 0; f2 = f2->prev)
+ f2->intermediate = 1;
+ /* .INTERMEDIATE with no deps does nothing.
+ Marking all files as intermediates is useless
+ since the goal targets would be deleted after they are built. */
+ }
+
+ for (f = lookup_file (".SECONDARY"); f != 0; f = f->prev)
+ {
+ /* .SECONDARY with deps listed
+ marks those deps as intermediate files
+ in that they don't get rebuilt if not actually needed;
+ but unlike real intermediate files,
+ these are not deleted after make finishes. */
+ if (f->deps)
+ {
+ for (d = f->deps; d != 0; d = d->next)
+ for (f2 = d->file; f2 != 0; f2 = f2->prev)
+ f2->intermediate = f2->secondary = 1;
+ }
+ /* .SECONDARY with no deps listed marks *all* files that way. */
+ else
+ {
+ int i;
+ for (i = 0; i < FILE_BUCKETS; i++)
+ for (f2 = files[i]; f2; f2= f2->next)
+ f2->intermediate = f2->secondary = 1;
+ }
+ }
+
f = lookup_file (".EXPORT_ALL_VARIABLES");
if (f != 0 && f->is_target)
export_all_variables = 1;