summaryrefslogtreecommitdiff
path: root/implicit.c
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@kolpackov.net>2005-03-10 09:14:09 +0000
committerBoris Kolpackov <boris@kolpackov.net>2005-03-10 09:14:09 +0000
commitd584d0c1c6945e0b498365e7d17f0fe3cb449d04 (patch)
treec5cd5fd3fe111b0f84bd62c85ccb2e4f9f32f18d /implicit.c
parent18251c4633134c704464d7c567d82a110ab820c8 (diff)
downloadgunmake-d584d0c1c6945e0b498365e7d17f0fe3cb449d04.tar.gz
Fixed Savannah bug #12267.
Diffstat (limited to 'implicit.c')
-rw-r--r--implicit.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/implicit.c b/implicit.c
index ab3879b..338a29f 100644
--- a/implicit.c
+++ b/implicit.c
@@ -798,15 +798,29 @@ pattern_search (struct file *file, int archive,
of F below are null before we change them. */
struct file *imf = d->intermediate_file;
- register struct file *f = enter_file (imf->name);
+ register struct file *f = lookup_file (imf->name);
+
+ /* We don't want to delete an intermediate file that happened
+ to be a prerequisite of some (other) target. Mark it as
+ precious. */
+ if (f != 0)
+ f->precious = 1;
+ else
+ f = enter_file (imf->name);
+
f->deps = imf->deps;
f->cmds = imf->cmds;
f->stem = imf->stem;
f->also_make = imf->also_make;
f->is_target = 1;
- imf = lookup_file (d->intermediate_pattern);
- if (imf != 0 && imf->precious)
- f->precious = 1;
+
+ if (!f->precious)
+ {
+ imf = lookup_file (d->intermediate_pattern);
+ if (imf != 0 && imf->precious)
+ f->precious = 1;
+ }
+
f->intermediate = 1;
f->tried_implicit = 1;
for (dep = f->deps; dep != 0; dep = dep->next)