%% Edward Welbourne <[EMAIL PROTECTED]> writes:

  >> ... the section "Communicating Variables to a Sub-`make'" ...
  ew> but I wasn't communicating with a sub-make.
  ew> No recursive make was involved.

  >> ... says make exports a variable to a sub-command ...

  ew> the relevant section *appears* to be saying that make exports
  ew> variables to sub-`make' invocations, though I agree it *could* be
  ew> construed as saying that it is passed down to all sub-shells.

>From make's perspective there's little difference between a sub-make and
any other command.  Both are invoked in precisely the same way, and both
get precisely the same environment.

There is no 100% guaranteed way for make to tell whether any given
command it's invoking is a sub-make, vs. any other kind of command like
a compile.

There are certain situations, like -n processing, where make attempts to
intuit whether a sub-command is a make or not, but this aren't
necessarily, nor are they required to be, always correct.

The MAKEFLAGS, etc. environment variables are put in _every_
subcommand's environment.  All environments for every sub-process that
make runs is invoked using _exactly_ the same environment.

  ew> If the latter is really true, the section Commands -> Execution
  ew> should explain that each sub-shell is executed in an environment
  ew> which is augmented with every (sensibly-named) make variable set
  ew> in the invoking Makefile, exported as an environment variable;

But that's not true, and I never said it was true (and neither does the
documentation).

Please re-read the section of the document I quoted.

I will investigate whether there are other places this information would
be better put.

  ew> Further, given that MAKEFLAGS would be holding a copy of the
  ew> TIME=time I put on my command line, a recursive $(MAKE) doesn't
  ew> *need* TIME passed down to it via the environment

Although that behavior is mentioned in that section, it's not
being done because it's necessary in sub-makes.  This is basically a
parenthetical comment.

This behavior has been true of every make since the first one was
written in the '70's, and I _think_ (although my copy is at work) that
POSIX.2 requires it as well.  I'll have to look it up tomorrow.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

Reply via email to