summaryrefslogtreecommitdiff
path: root/implicit.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1993-02-21 22:03:38 +0000
committerRoland McGrath <roland@redhat.com>1993-02-21 22:03:38 +0000
commitc88072ca7473b4894f1de9d35b20aab613ed8bfb (patch)
treeae11ee87f95b4afcd7992c440cafe0583126397d /implicit.c
parenta609f1f9c234dbc37dc3f57991720c836c2b93ff (diff)
downloadgunmake-c88072ca7473b4894f1de9d35b20aab613ed8bfb.tar.gz
Formerly implicit.c.~10~
Diffstat (limited to 'implicit.c')
-rw-r--r--implicit.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/implicit.c b/implicit.c
index 842956d..9a8defb 100644
--- a/implicit.c
+++ b/implicit.c
@@ -308,8 +308,7 @@ pattern_search (file, archive, depth, recursions)
stem = filename
+ (rule->suffixes[matches[i]] - rule->targets[matches[i]]) - 1;
stemlen = namelen - rule->lens[matches[i]] + 1;
- check_lastslash = (lastslash != 0
- && index (rule->targets[matches[i]], '/') == 0);
+ check_lastslash = checked_lastslash[i];
if (check_lastslash)
{
stem += lastslash - filename + 1;
@@ -331,6 +330,7 @@ pattern_search (file, archive, depth, recursions)
register unsigned int i;
if (check_lastslash)
{
+ /* Copy directory name from the original FILENAME. */
i = lastslash - filename + 1;
bcopy (filename, depname, i);
}
@@ -364,7 +364,16 @@ pattern_search (file, archive, depth, recursions)
DEBUGP2 ("Trying %s dependency `%s'.\n",
p == depname ? "implicit" : "rule", p);
- if (!rule->subdir && (lookup_file (p) != 0 || file_exists_p (p)))
+
+ /* The DEP->changed flag says that this dependency resides in a
+ nonexistent directory. So we normally can skip looking for
+ the file. However, if CHECK_LASTSLASH is set, then the
+ dependency file we are actually looking for is in a different
+ directory (the one gotten by prepending FILENAME's directory),
+ so it might actually exist. */
+
+ if ((!dep->changed || check_lastslash)
+ && (lookup_file (p) != 0 || file_exists_p (p)))
{
found_files[deps_found++] = savestring (p, strlen (p));
continue;
@@ -532,6 +541,8 @@ pattern_search (file, archive, depth, recursions)
file->stem = stem[stemlen] == '\0' ? stem : savestring (stem, stemlen);
else
{
+ /* We want to prepend the directory from
+ the original FILENAME onto the stem. */
file->stem = (char *) xmalloc (((lastslash + 1) - filename)
+ stemlen + 1);
bcopy (filename, file->stem, (lastslash + 1) - filename);