[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to privately export a variable?
From: |
Masahiro Yamada |
Subject: |
Re: How to privately export a variable? |
Date: |
Mon, 9 Jan 2023 04:12:52 +0900 |
On Sun, Jan 8, 2023 at 10:55 PM Paul Smith <psmith@gnu.org> 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