help-make
[Top][All Lists]
Advanced

[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:02:55 -0400 (EDT)

On Wed, 9 Jun 2004, Noel Yap wrote:

> Robert P. J. Day wrote:
 
> >   there *is*, of course, a difference between a)/b) and c) in that, in the
> > docs, a) and b) refer to getting a variable from the "environment", while
> > c) is described as getting a variable value as a "command argument", and
> > those situations are clearly processed differently depending on whether
> > you want to override that value in the makefile, etc. that is, a simple
> > assignment in a makefile will override a value coming in as part of the
> > *environment*, but not as a command argument (unless you use the
> > "override" directive, etc.).  is this accurate so far?
> 
> This sounds familiar although I haven't memorized the details.  IMHO,
> taking advantage of this doesn't scale well since no one ever remembers
> the details.

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 ...

rday




reply via email to

[Prev in Thread] Current Thread [Next in Thread]