help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scoping of variables


From: Warlich, Christof
Subject: scoping of variables
Date: Thu, 4 Nov 2010 13:47:19 +0100

This is a newbie question, so please bear with me if similar questions have 
been discussed before.
I couldn't find anything in the list archives though.

I'd like to build a big project that spawns several directories, but don't want 
to call make recursively
because I read "Recursive Make Considered 
Harmful<http://miller.emu.id.au/pmiller/books/rmch/>". But when doing 
everything in a single makefile
(in fact including submakefiles recursively through make's include directive), 
I'm running into the problem
that scoping of variables within directories (each being handled with its own 
standalone makefile previously)
doesn't work any more.

AFAICS, the obvious way to work arround this would be to implement a stack for 
each of the "to be scoped"
variables, which always points to the proper instance of the variable depending 
on the submakefile being
in charge. But while this should not be too dificult to do when utilizing the  
"GNU Make Standard Library<http://gmsl.sourceforge.net/>", it
may become messy when scoping is needed for many variables.

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?

Thanks for any help,

Christof





reply via email to

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