On Sun, 2023-01-08 at 21:14 +0900, Masahiro Yamada wrote:
> I expected "private export" would mean
> "privately export", but it is the same as "export".
> The variable is exported not only to 'foo',
> but also to 'bar' and 'baz'.

This is a bug, which has been fixed for the next release:

https://savannah.gnu.org/bugs/?61463

In the meantime it will work to separate the export from the private,
like this:

    FOR_FOO := global

    foo: private export FOR_FOO = $(p_FOO)
    foo: private p_FOO := 1

    foo: bar baz
    foo bar baz: ; @echo $@: $$FOR_FOO

(the "private" on the first foo: line doesn't have the desired effect
until the above bug is fixed but I left it there anyway).

Note it's of course critically important to use "=" in the export
assignment, not ":=".

Reply via email to