Finish the fix in revision 1.39 -- make(1)'s behavior is now

"greedy" with respect to finding the dependency operators.

Approved by:	re
This commit is contained in:
Ruslan Ermilov 2002-11-28 12:47:56 +00:00
parent d5216a4fb7
commit 43b92fef62
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107373

View File

@ -729,14 +729,15 @@ ParseDoDependency (char *line)
} else if (*cp == '!' || *cp == ':') {
/*
* We don't want to end a word on ':' or '!' if there is a
* better match later on in the string. By "better" I mean
* one that is followed by whitespace. This allows the user
* to have targets like:
* better match later on in the string (greedy matching).
* This allows the user to have targets like:
* fie::fi:fo: fum
* where "fie::fi:fo" is the target. In real life this is used
* for perl5 library man pages where "::" separates an object
* from its class. Ie: "File::Spec::Unix". This behaviour
* is also consistent with other versions of make.
* foo::bar:
* where "fie::fi:fo" and "foo::bar" are the targets. In
* real life this is used for perl5 library man pages where
* "::" separates an object from its class.
* Ie: "File::Spec::Unix". This behaviour is also consistent
* with other versions of make.
*/
char *p = cp + 1;
@ -747,11 +748,7 @@ ParseDoDependency (char *line)
if (*p == '\0' || isspace(*p))
break;
do {
p += strcspn(p, "!:");
if (*p == '\0')
break;
} while (!isspace(*++p));
p += strcspn(p, "!:");
/* No better match later on... */
if (*p == '\0')