summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2002-08-20 12:50:32 +0000
committerru <ru@FreeBSD.org>2002-08-20 12:50:32 +0000
commit4c934d6757f554929a29beba924356eb964c1329 (patch)
tree811b7c72c8d8e47199080f8aac056e68bc92bc85 /usr.bin/make
parent7c0560a37b248afacb0d75f732140d2ad7126181 (diff)
downloadFreeBSD-src-4c934d6757f554929a29beba924356eb964c1329.zip
FreeBSD-src-4c934d6757f554929a29beba924356eb964c1329.tar.gz
Allow embedded `:' and `!' in target names.
PR: bin/6612 Obtained from: OpenBSD MFC after: 1 week
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/parse.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 213bc3e..d4831f1 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;
}
OpenPOWER on IntegriCloud