%% "Martin d'Anjou" <[EMAIL PROTECTED]> writes:

  md> $ make
  md> makefile:2: FOO = foo
  md> makefile:5: FOO = foo bar
  md> makefile:9: FOO = foo bar biz
  md> FOO = boz baz / $FOO =

Oh whoops... I should have added "export FOO" to the makefile.

  md> $ setenv FOO gig
  md> $ make
  md> makefile:2: FOO = gig foo
  md> makefile:5: FOO = gig foo bar
  md> makefile:9: FOO = gig foo bar biz
  md> FOO = boz baz / $FOO = boz baz

  md> Why in the second case "/ $FOO" prints "boz baz" and not the empty
  md> string?

Make automatically exports all variables that were in the environment
when it started up.  It doesn't export other, normal make variables.

So, by adding FOO to the environment before you started make you caused
it to be exported.

  md> When I do "make -e":

  md> $ make -e
  md> makefile:2: FOO = gig
  md> makefile:5: FOO = gig
  md> makefile:9: FOO = gig
  md> FOO = gig / $FOO = gig

Right.  Adding -e changes the precedence rules and causes values in the
environment to take precedence over values set in the makefile.

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


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to