On 2023-12-04 08:50, Cook, Malcolm wrote: 
> .PHONY: myTarget
> myTarget: private export BASH_ENV:=desiredEnvironment.sh

I don't have the answer, but I'm just wondering whether order
makes any difference here: what if you write "export private"
rather than "private export"?

I.e. are these just Boolean attributes applied to the variable
assignment before its semantics play out (so their order
doesn't matter) or is there a syntax-directed evaluation strategy
where the order makes a difference. Like Make does the export
first, then the environment variable escapes, and the variable
then becoming private does not remove the environment variable.

Might it be that "export" and "private" are just sort of
semantic opposites that don't make sense? Kind of like combining
"static extern" in C?

You can always do this to give a specific command its needed
environment variable:

    BASH_ENV=$(bash_env) recipe command ...

I.e. have an unexported bash_env variable which is then injected
into the specific command that needs it. You don't even have
to make it private, since the prerequisites don't reference it.

Reply via email to