diff options
author | Ruslan Ermilov <ru@FreeBSD.org> | 2002-08-20 12:50:32 +0000 |
---|---|---|
committer | Ruslan Ermilov <ru@FreeBSD.org> | 2002-08-20 12:50:32 +0000 |
commit | 4612010cddf42f04f456351a246afbf9d80bdf2e (patch) | |
tree | 811b7c72c8d8e47199080f8aac056e68bc92bc85 /usr.bin | |
parent | 6527574b75d849ccc3562baa9d119ee7fc18cba1 (diff) | |
download | src-4612010cddf42f04f456351a246afbf9d80bdf2e.tar.gz src-4612010cddf42f04f456351a246afbf9d80bdf2e.zip |
Allow embedded `:' and `!' in target names.
PR: bin/6612
Obtained from: OpenBSD
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=102178
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/parse.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 213bc3ecee38..d4831f15fc77 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -723,8 +723,7 @@ ParseDoDependency (line) do { for (cp = line; - *cp && !isspace ((unsigned char) *cp) && - (*cp != '!') && (*cp != ':') && (*cp != '('); + *cp && !isspace ((unsigned char) *cp) && *cp != '('; cp++) { if (*cp == '$') { @@ -745,6 +744,36 @@ ParseDoDependency (line) free(result); } cp += length-1; + } 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: + * 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. + */ + char *p = cp + 1; + + if (*cp == ':' && *p == ':'); + p++; + + /* Found the best match already. */ + if (*p == '\0' || isspace(*p)) + break; + + do { + p += strcspn(p, "!:"); + if (*p == '\0') + break; + } while (!isspace(*++p)); + + /* No better match later on... */ + if (*p == '\0') + break; } continue; } |