On Thu, 2010-11-04 at 13:47 +0100, Warlich, Christof wrote:
> So my question boils down to: Is ther a better way to achive scoping
> of variables? Maybe it is possible to push, pop and restore the entire
> environment? Or do I even overlook a more obvious and simple solution?

No, there is no such thing as variable scoping in GNU make.  The sole
exception is for target- and pattern-specific variables, but that's
probably too fine-grained to be useful for your purposes.

People typically implement scoping implicitly, through a variable naming
convention.

It IS possible to prevent "leaking" of variables by unsetting variables
that match a given pattern, using the .VARIABLES variable which contains
the names of all defined variables.  However you have to be very careful
about this due to variable expansion rules: variables inside recipes are
only expanded at the very end, when the recipe is run.  If you've unset
a variable that is used inside that recipe, then it won't work
correctly.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email protected]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "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