summaryrefslogtreecommitdiff
path: root/vpath.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2006-02-06 16:21:59 +0000
committerPaul Smith <psmith@gnu.org>2006-02-06 16:21:59 +0000
commita4e3523fe408158c15026a884d1515c34de27de6 (patch)
tree04e2cbfa11c6c6f30c625a6427f736d0719fbb76 /vpath.c
parent7a8549f5dd339eec9cb57c8cfe11cf71b77759d2 (diff)
downloadgunmake-a4e3523fe408158c15026a884d1515c34de27de6.tar.gz
Fix Savannah bugs # 15341, 15534, and 15533.
Rewrite large chunks of the "Commands" section of the manual to better describe then backslash-newline handling, the SHELL variable, etc.
Diffstat (limited to 'vpath.c')
-rw-r--r--vpath.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/vpath.c b/vpath.c
index 458fb18..05f15c6 100644
--- a/vpath.c
+++ b/vpath.c
@@ -466,11 +466,27 @@ selective_vpath_search (struct vpath *path, char **file,
In December 1993 I loosened this restriction to allow a file
to be chosen if it is mentioned as a target in a makefile. This
- seem logical. */
+ seem logical.
+
+ Special handling for -W / -o: make sure we preserve the special
+ values here. Actually this whole thing is a little bogus: I think
+ we should ditch the name/hname thing and look into the renamed
+ capability that already exists for files: that is, have a new struct
+ file* entry for the VPATH-found file, and set the renamed field if
+ we use it.
+ */
{
struct file *f = lookup_file (name);
if (f != 0)
- exists = not_target || f->is_target;
+ {
+ exists = not_target || f->is_target;
+ if (exists && mtime_ptr
+ && (f->last_mtime == OLD_MTIME || f->last_mtime == NEW_MTIME))
+ {
+ *mtime_ptr = f->last_mtime;
+ mtime_ptr = 0;
+ }
+ }
}
if (!exists)
@@ -517,6 +533,13 @@ selective_vpath_search (struct vpath *path, char **file,
exists = 0;
continue;
}
+
+ /* Store the modtime into *MTIME_PTR for the caller. */
+ if (mtime_ptr != 0)
+ {
+ *mtime_ptr = FILE_TIMESTAMP_STAT_MODTIME (name, st);
+ mtime_ptr = 0;
+ }
}
/* We have found a file.
@@ -524,13 +547,10 @@ selective_vpath_search (struct vpath *path, char **file,
*file = savestring (name, (n + 1 - name) + flen);
+ /* If we get here and mtime_ptr hasn't been set, record
+ UNKNOWN_MTIME to indicate this. */
if (mtime_ptr != 0)
- /* Store the modtime into *MTIME_PTR for the caller.
- If we have had no need to stat the file here,
- we record UNKNOWN_MTIME to indicate this. */
- *mtime_ptr = (exists_in_cache
- ? FILE_TIMESTAMP_STAT_MODTIME (name, st)
- : UNKNOWN_MTIME);
+ *mtime_ptr = UNKNOWN_MTIME;
free (name);
return 1;