Re: Scope problem

Lars Ivar Igesund <[email protected]> Sat, 24 Apr 2004 16:49:00 +0100
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
Bram Moolenaar wrote:

> Lars Ivar Igesund wrote:
> 
> 
>>I have a main recipe, and a couple of child recipes.
>>
>>The first child recipe sets the content of GTK_LIBS that I
>>use in the second. It works if GTK_LIBS is set at the top
>>of the recipe (using the _top scope). But the contents of GTK_LIBS
>>is dependent on information from the target gtkdirs and thus I do
>>as below. Now GTK_LIBS isn't accessible from my other recipe anymore.
>>
>>gtkdirs {virtual} :
>>     #setting some variables
>>
>>gtklibs : gtkdirs
>>     _top.GTK_LIBS = lots of libraries
> 
> 
> I'm quite sure that the top scope is available everywhere.  Perhaps the
> problem is that you use $_top.GTK_LIBS in a dependency, and it's only
> set when executing dependencies?  Remember that Aap expands variables
> when they are set, unlike "make".
> 
> Perhaps you can give a complete example of the problem.
> 

Ok, heres an example with only the relevant stuff:

main.aap
--------------
:child foo1.aap
:child foo2.aap


foo1.aap
--------------
gtkdir {virtual} :
     GTK_BIN = "dir coming from file_path()"

gtklib : gtkdir
     _top.GTK_LIBS = GTK_BIN

all : gtklib


foo2.aap
---------------
LIBS = $_top.GTK_LIBS


Now execute the main recipe to get an error from foo2

Lars Ivar


-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297