[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: a couple more questions about variables and scope
From: |
Robert P. J. Day |
Subject: |
Re: a couple more questions about variables and scope |
Date: |
Wed, 9 Jun 2004 10:54:52 -0400 (EDT) |
On Wed, 9 Jun 2004, Tristan Van Berkom wrote:
> Robert P. J. Day wrote:
> [...]
> > exactly. :-) one more piece of clarification. in section 6.9, i read:
> >
> > "Every environment variable that make sees when it starts up is
> > transformed into a make variable with the same name and value."
> >
> > so this means, then, that there is no effective difference between getting
> > an environment variable from a caller, and creating (and exporting) a
> > variable within a makefile? would it be more technically correct to
> > rephrase the sentence above by appending "... and then exported"? since
> > if you just assign a value to a variable, that will *not* be available to
> > sub-makes unless you export it first.
> >
> > am i making sense? there's only decaf left here. grrr ...
> >
> Note that variables assigned through the environment are "assigned"
> before
> your makefiles assign variables (so makefile assignments "override" the
> environment), but variables assigned on the command line
> (i.e. make DEBUG=true all) override variables assigned inside the makefiles
> except ofcourse if you use the keyword "override" in your makefile
that wasn't quite the point i was making. what i was wondering about was
the specific mechanics of how environment variables were incorporated into
the makefile. according to that sentence, an environment variable is
transformed into a make variable with the same name and value.
but that's clearly not enough. in addition, that make variable would also
have to be exported so that it was available to all submakes, as an
environment variable would be.
perhaps a better question might be, at the beginning of the make, how
*exactly* are environment variables added to the mix so that, once that
processing is done, is there any record that those variables came from the
calling environment as opposed to, say, being set as make variables and
then exported? does make distinguish between those two?
man, i'm tired. i need a nap.
rday