Dir_MTime did not search for a file using the correct parh; i.e. it was

ignoring suffix-specific path search. So if a node was marked .MADE,
then suffix rules would not be applied to it, and we would look for
the file only in the default path, not the suffix-specific path.

XXX: Now that we looked for the suffix, we can save it in the GNode,
but we don't do this yet.
This commit is contained in:
christos 2004-12-29 00:43:02 +00:00
parent d07caa7269
commit 8415275dbd
3 changed files with 51 additions and 38 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.43 2004/07/01 20:38:09 jmc Exp $ */
/* $NetBSD: dir.c,v 1.44 2004/12/29 00:43:02 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: dir.c,v 1.43 2004/07/01 20:38:09 jmc Exp $";
static char rcsid[] = "$NetBSD: dir.c,v 1.44 2004/12/29 00:43:02 christos Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else
__RCSID("$NetBSD: dir.c,v 1.43 2004/07/01 20:38:09 jmc Exp $");
__RCSID("$NetBSD: dir.c,v 1.44 2004/12/29 00:43:02 christos Exp $");
#endif
#endif /* not lint */
#endif
@ -1430,7 +1430,7 @@ Dir_MTime(GNode *gn)
if (gn->type & OP_NOPATH)
fullName = NULL;
else
fullName = Dir_FindFile (gn->name, dirSearchPath);
fullName = Dir_FindFile (gn->name, Suff_FindPath(gn));
} else {
fullName = gn->path;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nonints.h,v 1.32 2004/05/07 08:12:16 sjg Exp $ */
/* $NetBSD: nonints.h,v 1.33 2004/12/29 00:43:02 christos Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@ -153,6 +153,7 @@ void Suff_DoPaths(void);
void Suff_AddInclude(char *);
void Suff_AddLib(char *);
void Suff_FindDeps(GNode *);
Lst Suff_FindPath(GNode *);
void Suff_SetNull(char *);
void Suff_Init(void);
void Suff_End(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: suff.c,v 1.45 2004/05/07 00:04:40 ross Exp $ */
/* $NetBSD: suff.c,v 1.46 2004/12/29 00:43:02 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: suff.c,v 1.45 2004/05/07 00:04:40 ross Exp $";
static char rcsid[] = "$NetBSD: suff.c,v 1.46 2004/12/29 00:43:02 christos Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
#else
__RCSID("$NetBSD: suff.c,v 1.45 2004/05/07 00:04:40 ross Exp $");
__RCSID("$NetBSD: suff.c,v 1.46 2004/12/29 00:43:02 christos Exp $");
#endif
#endif /* not lint */
#endif
@ -1505,7 +1505,6 @@ SuffExpandChildren(LstNode prevLN, GNode *pgn)
{
GNode *cgn = (GNode *) Lst_Datum(prevLN);
GNode *gn; /* New source 8) */
LstNode ln; /* List element for old source */
char *cp; /* Expanded value */
/*
@ -1633,37 +1632,9 @@ SuffExpandChildren(LstNode prevLN, GNode *pgn)
} else if (Dir_HasWildcards(cgn->name)) {
Lst explist; /* List of expansions */
Lst path; /* Search path along which to expand */
SuffixCmpData sd; /* Search string data */
/*
* Find a path along which to expand the word.
*
* If the word has a known suffix, use that path.
* If it has no known suffix and we're allowed to use the null
* suffix, use its path.
* Else use the default system search path.
*/
sd.len = strlen(cgn->name);
sd.ename = cgn->name + sd.len;
ln = Lst_Find(sufflist, (ClientData)&sd, SuffSuffIsSuffixP);
path = Suff_FindPath(cgn);
if (DEBUG(SUFF)) {
printf("Wildcard expanding \"%s\"...", cgn->name);
}
if (ln != NILLNODE) {
Suff *s = (Suff *)Lst_Datum(ln);
if (DEBUG(SUFF)) {
printf("suffix is \"%s\"...", s->name);
}
path = s->searchPath;
} else {
/*
* Use default search path
*/
path = dirSearchPath;
}
/*
* Expand the word along the chosen path
@ -1712,6 +1683,47 @@ SuffExpandChildren(LstNode prevLN, GNode *pgn)
return(0);
}
/*
* Find a path along which to expand the word.
*
* If the word has a known suffix, use that path.
* If it has no known suffix and we're allowed to use the null
* suffix, use its path.
* Else use the default system search path.
*/
Lst
Suff_FindPath(GNode* gn)
{
Suff *suff = gn->suffix;
if (suff == NULL) {
SuffixCmpData sd; /* Search string data */
LstNode ln;
sd.len = strlen(gn->name);
sd.ename = gn->name + sd.len;
ln = Lst_Find(sufflist, (ClientData)&sd, SuffSuffIsSuffixP);
if (DEBUG(SUFF)) {
printf("Wildcard expanding \"%s\"...", gn->name);
}
if (ln != NILLNODE)
suff = (Suff *)Lst_Datum(ln);
/* XXX: Here we can save the suffix so we don't have to do this again */
}
if (suff != NULL) {
if (DEBUG(SUFF)) {
printf("suffix is \"%s\"...", suff->name);
}
return suff->searchPath;
} else {
/*
* Use default search path
*/
return dirSearchPath;
}
}
/*-
*-----------------------------------------------------------------------
* SuffApplyTransform --