ParseDoSpecialSrc: since we're already being called for each target

make it depend only on the expansion of src that matches.
Otherwise given:

a b c:  ${.TARGET}.x

a b and c will each depend on a.x, b.x and c.x

Further, we only _need_ to do ParseDoSpecialSrc if a .WAIT appears
in the source list - so establish that up front.
This commit is contained in:
sjg 2003-03-22 23:41:02 +00:00
parent 17bba97d2e
commit 77076c2d51
1 changed files with 31 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.89 2003/03/21 19:14:53 christos Exp $ */ /* $NetBSD: parse.c,v 1.90 2003/03/22 23:41:02 sjg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -39,14 +39,14 @@
*/ */
#ifdef MAKE_BOOTSTRAP #ifdef MAKE_BOOTSTRAP
static char rcsid[] = "$NetBSD: parse.c,v 1.89 2003/03/21 19:14:53 christos Exp $"; static char rcsid[] = "$NetBSD: parse.c,v 1.90 2003/03/22 23:41:02 sjg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: parse.c,v 1.89 2003/03/21 19:14:53 christos Exp $"); __RCSID("$NetBSD: parse.c,v 1.90 2003/03/22 23:41:02 sjg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -624,6 +624,7 @@ static int
ParseDoSpecialSrc(ClientData tp, ClientData sp) ParseDoSpecialSrc(ClientData tp, ClientData sp)
{ {
GNode *tn = (GNode *) tp; GNode *tn = (GNode *) tp;
GNode *gn;
SpecialSrc *ss = (SpecialSrc *) sp; SpecialSrc *ss = (SpecialSrc *) sp;
char *cp; char *cp;
char *cp2; char *cp2;
@ -649,9 +650,26 @@ ParseDoSpecialSrc(ClientData tp, ClientData sp)
} else } else
Var_Set(PREFIX, pref, tn, 0); Var_Set(PREFIX, pref, tn, 0);
cp = Var_Subst(NULL, ss->src, tn, FALSE); cp = Var_Subst(NULL, ss->src, tn, FALSE);
if (strchr(cp, '$')) if (strchr(cp, '$')) {
Parse_Error(PARSE_WARNING, "Cannot resolve '%s' here", ss->src); Parse_Error(PARSE_WARNING, "Cannot resolve '%s' here", ss->src);
ParseDoSrc(ss->op, cp, ss->allsrc, FALSE); /* don't come back */ ParseDoSrc(ss->op, ss->src, ss->allsrc, FALSE); /* don't come back */
return 1; /* stop list traversal */
}
/*
* We don't want to make every target dependent on sources for
* other targets. This is the bit of ParseDoSrc which is relevant.
*/
gn = Targ_FindNode (cp, TARG_CREATE);
if (ss->op) {
gn->type |= ss->op;
} else {
ParseLinkSrc((ClientData)tn, (ClientData)gn);
}
gn->order = waiting;
(void)Lst_AtEnd(ss->allsrc, (ClientData)gn);
if (waiting) {
ParseAddDep((ClientData)tn, (ClientData)gn);
}
return 0; return 0;
} }
@ -898,6 +916,7 @@ ParseDoDependency(char *line)
* to the targets list */ * to the targets list */
Lst curSrcs; /* list of sources in order */ Lst curSrcs; /* list of sources in order */
char *lstart = line; char *lstart = line;
Boolean hasWait; /* is .WAIT present in srcs */
tOp = 0; tOp = 0;
@ -1338,6 +1357,11 @@ ParseDoDependency(char *line)
if (specType == ExPath) if (specType == ExPath)
Dir_SetPATH(); Dir_SetPATH();
} else { } else {
/*
* We don't need ParseDoSpecialSrc unless .WAIT is present.
*/
hasWait = (strstr(line, ".WAIT") != NULL);
while (*line) { while (*line) {
/* /*
* The targets take real sources, so we must beware of archive * The targets take real sources, so we must beware of archive
@ -1368,7 +1392,7 @@ ParseDoDependency(char *line)
while (!Lst_IsEmpty (sources)) { while (!Lst_IsEmpty (sources)) {
gn = (GNode *) Lst_DeQueue (sources); gn = (GNode *) Lst_DeQueue (sources);
ParseDoSrc (tOp, gn->name, curSrcs, TRUE); ParseDoSrc (tOp, gn->name, curSrcs, hasWait);
} }
Lst_Destroy (sources, NOFREE); Lst_Destroy (sources, NOFREE);
cp = line; cp = line;
@ -1378,7 +1402,7 @@ ParseDoDependency(char *line)
cp += 1; cp += 1;
} }
ParseDoSrc (tOp, line, curSrcs, TRUE); ParseDoSrc (tOp, line, curSrcs, hasWait);
} }
while (*cp && isspace ((unsigned char)*cp)) { while (*cp && isspace ((unsigned char)*cp)) {
cp++; cp++;