Subject: Re: need a C++ compiler? (was: CVS commit: pkgsrc)
To: None <tech-pkg@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-pkg
Date: 02/03/2004 00:52:18
On Mon, 02 Feb 2004, Alan Barrett wrote:
> If you want just the first word from ${CC}, then why not use ${CC:[1]}?

[Answer: because that doesn't work in all versions of make that we care
about.]

OK, here's something that should work in a version of make that has :C///1
and :M, even if it does not have :[] or :C///W.

	${CC:C/^xyzzy//:C/^/xyzzy/1:Mxyzzy*:C/^xyzzy//}

Unlike ${CC:C/^-.*//}, the above should work with things like

	CC= /some/path/cc -foo bar

It should even work if some word other than the first word of $CC begins
with xyzzy, but it will not work if the first word begins with xyzzy,
or if any other word begins with xyzzyxyzzy.

--apb (Alan Barrett)