Re: How to privately export a variable?

Masahiro Yamada <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Message-ID <CAK7LNARKuxiETOvgdwRijjNhb93nwHPeLE04-W6VNT92f-h9gQ@mail.gmail.com>
On Sun, Jan 8, 2023 at 10:55 PM Paul Smith <[email protected]> wrote:
>
> 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 ":=".


Ah, it was fixed recently.

The workaround works for me.
Thanks!


--
Best Regards
Masahiro Yamada
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.