Re: Building two programs and setting INCLUDE for each

Bram Moolenaar <[email protected]> Wed, 10 Aug 2005 11:10:31 +0200
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
Bram -

> I found some information about this in the mailintlist archive, but
> I'm just running this through here, because these messages used the
> SOURCES variable (which is now outdated as far as I know).
> 
> I've got two ":program"'s in the same aap file, each requiering a
> different INCLUDE (and DEFINE and LIBS).
> 
> Now, resetting INCLUDE doesn't seem to work, because before the recipe
> is executed, the variable is reset (which is how it should be).

You set the variable when the recipe is parsed, which is before the
dependencies are figured out and the build commands executed.  Thus only
the last value of INCLUDE will be used.

> So, my question is: what is the best way to handle this? And I'd love
> to see this be added to the "building two programs" example in the
> manual.
> 
> What I found in the mailinglist was:
> OneIncludes="-Ia"
> TwoIncludes="-Ib"
> 
> :program one : one.cc { var_INCLUDE = $OneIncludes}
> 
> :program two : two.cc { var_INCLUDE = $TwoIncludes}
> 
> Is this (most probably) going to be the standard way of handling this?
> Or should I create or use scopes or something?

Since the compiler flags are related to the source file this is indeed
the right method.

Somehow it's quite difficult to find these things in the documentation.
I often have the same problem myself.  If someone can suggest a better
organisation that is very welcome.

- Bram

-- 
How To Keep A Healthy Level Of Insanity:
5. Put decaf in the coffee maker for 3 weeks. Once everyone has gotten
   over their caffeine addictions, switch to expresso.

 /// 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        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf