We cannot skip all Suff processing for .PHONY targets,

else, srcs which are wildcards do not get expanded as needed.
This commit is contained in:
sjg 2013-05-18 13:13:34 +00:00
parent aea6f93e2d
commit 2987902a0c

View File

@ -1,4 +1,4 @@
/* $NetBSD: suff.c,v 1.69 2011/09/29 23:38:04 sjg Exp $ */
/* $NetBSD: suff.c,v 1.70 2013/05/18 13:13:34 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: suff.c,v 1.69 2011/09/29 23:38:04 sjg Exp $";
static char rcsid[] = "$NetBSD: suff.c,v 1.70 2013/05/18 13:13:34 sjg 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.69 2011/09/29 23:38:04 sjg Exp $");
__RCSID("$NetBSD: suff.c,v 1.70 2013/05/18 13:13:34 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -2058,6 +2058,10 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
* children, then look for any overriding transformations they imply.
* Should we find one, we discard the one we found before.
*/
bottom = NULL;
targ = NULL;
if (!(gn->type & OP_PHONY)) {
while (ln != NULL) {
/*
@ -2083,8 +2087,9 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
#endif
/*
* Allocate room for the prefix, whose end is found by subtracting
* the length of the suffix from the end of the name.
* Allocate room for the prefix, whose end is found by
* subtracting the length of the suffix from
* the end of the name.
*/
prefLen = (eoname - targ->suff->nameLen) - sopref;
targ->pref = bmake_malloc(prefLen + 1);
@ -2148,15 +2153,15 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
}
/*
* Using the list of possible sources built up from the target suffix(es),
* try and find an existing file/target that matches.
* Using the list of possible sources built up from the target
* suffix(es), try and find an existing file/target that matches.
*/
bottom = SuffFindThem(srcs, slst);
if (bottom == NULL) {
/*
* No known transformations -- use the first suffix found for setting
* the local variables.
* No known transformations -- use the first suffix found
* for setting the local variables.
*/
if (!Lst_IsEmpty(targs)) {
targ = (Src *)Lst_Datum(Lst_First(targs));
@ -2171,6 +2176,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
for (targ = bottom; targ->parent != NULL; targ = targ->parent)
continue;
}
}
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn, 0);
@ -2419,12 +2425,7 @@ SuffFindDeps(GNode *gn, Lst slst)
*/
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn, 0);
Var_Set(PREFIX, gn->name, gn, 0);
if (gn->type & OP_PHONY) {
/*
* If this is a .PHONY target, we do not apply suffix rules.
*/
return;
}
if (DEBUG(SUFF)) {
fprintf(debug_file, "SuffFindDeps (%s)\n", gn->name);
}