Re: toughts on the :child command
Bram Moolenaar <[email protected]> Fri, 06 Feb 2004 12:07:39 +0100
| Newsgroups | gmane.comp.tools.aap.user |
|---|---|
| Message-ID | <[email protected]> |
John Williams wrote:
> I've been trying to work out how one might build a large project that uses
> the :child command to combine several recipe files together. The example
> given in the tutorial involves too much boilerplace code for my liking,
> and the logic just seems a little backwards to me. Also I'm a little
> constrained in how things work since I'm trying to replace Makefiles for
> some complicated project and I want to keep the functionality as similar
> as possible.
>
> What I would *LIKE* to do is put a project-wide 'main.aap' in the root of
> the project hierarchy and put a file to build libraries in the 'src/lib'
> directory. I want the build libraries to go into the 'lib/linux'
> directory.
>
> --- main.aap ---
>
> Top = `os.getcwd()`
> LibTop = $Top/lib/linux
> INCLUDES = -I$Top/include
> :child src/lib/child.aap
>
> --- src/lib/child.aap ---
>
> :dll $LibTop/foo : foo1.cc foo2.cc
>
> --- end ---
>
> Several things about this annoy me. First, it seems like I shouldn't have
> to set $Top; based on the name, I would have expected $TOPDIR to do this
> for me, but instead it's just the opposite of what I want. Ideally I'd
> like $Top be expand to a relative path to the top-level directory, so the
> AAP output isn't so verbose, but I can't figure out a clean way to do this.
> How about creating a new builtin variable that expands to "." in the
> top-level file, "../.." in src/lib/child.app, etc.? Such a variable
> should probably also have a corresponding Python function just like $TOPDIR
> has topdir().
The $TOPDIR and $CHILDDIR variables were added to allow a child or
grandchild to give file names back to the parent or toplevel recipe,
without the need for the child recipe to know where it's located. I now
realize that $TOPDIR was not a good name for what it stands for.
What you did with $Top works and I don't see a real problem with it.
Except that it takes a bit of effort to make the paths relative (take
$TOPDIR and replace each part with ".."). Does this happen often enough
to add a feature in Aap for this? I suppose it does.
What would be good names for these variables? $PARENTDIR sounds
obvious, but $TOPDIR is confusing. I think backwards compatibility is
important, thus we can't change the existing $TOPDIR. $TOPLEVELDIR?
$STARTDIR? $ROOTDIR?
An alternative would be to provide a function that turns $TOPDIR into
a path with ".." parts. But that will not be easy to understand.
> My next problem is that the shared library built in src/lib/child.aap
> doesn't get added to the dependencies of the 'all' target. I could fix
> this by writing my own "all" target like this:
>
> all : $LibTop/${DLLPRE}malloc${DLLSUF}
>
> But that sure is ugly, and it would be a maintenence hassle when I'm
> building a lot of programs or libraries in one project, as often happens
> at my company.
This is a known bug, Adriaan also reported it. Sorry, didn't get fixed
yet. You could work around it by adding the target to $AllTarget in the
child recipe:
child:
AllTarget += $LibTop/foo
toplevel:
all : $AllTarget
--
hundred-and-one symptoms of being an internet addict:
53. To find out what time it is, you send yourself an e-mail and check the
"Date:" field.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn