Subject: Re: how to use USE_LANGUAGES
To: Klaus Heinz <firstname.lastname@example.org>
From: Roland Illig <rillig@NetBSD.org>
Date: 06/08/2007 23:01:42
Klaus Heinz wrote:
> "pkglint -e -Wall" says
> WARN: Makefile:17: Permission [a] requested for USE_LANGUAGES, but only
> [s] is allowed.
> The available permissions are:
> a append something using +=
> d set a default value using ?=
> s set a variable using :=, =, !=
> p use a variable during preprocessing
> u use a variable at runtime
> A "?" means that it is not yet clear which permissions are allowed
> and which aren't.
> Is this warning for USE_LANGUAGES+= correct?
Yes, it is.
> The action for target "fail-wrapper:" in mk/compiler.mk explicitly tells
> *** Please consider adding USE_LANGUAGES+=...
The one who wrote that wasn't me, so that may be the reason for the
inconsistency. I've fixed the wording of that warning.
> In chapter 23.2, the pkgsrc guide tells us more about USE_LANGUAGES but
> I do not understand what it says.
Hmm, that was me who wrote it. I still know what I wanted to say, but
it's so badly expressed that I can't expect anyone to understand it. :(
> Are we supposed to explicitly list a C compiler as necessary or can we
> rely on the pkgsrc guide (and the comment in compiler.mk) that
> The default is "c"
The default value is "c", but since it is not documented _when_ that
default value is set, you should not use the "+=" operator with that
Example 1 (doesn't work as expected):
In this case, USE_LANGUAGES will only have c++, but not c. The reason is
that when the default value is supposed to be set, the variable already
has a value, so nothing happens.
Example 2 (also doesn't work as expected):
In this case, USE_LANGUAGES has the value "c c++", but the
c++-fail-wrapper is created nevertheless. This is because compiler.mk is
protected from multiple inclusion, so the USE_LANGUAGES variable is
never inspected after the first .include line.
Example 3 (works perfectly):
USE_LANGUAGES= c c++
When you want something else than the default value, you have to
overwrite the complete value using the = operator.