Boost logo

Boost-Build :

Subject: Re: [Boost-build] How to build an external library using a makefile.
From: Alexander Sack (pisymbol_at_[hidden])
Date: 2008-11-21 11:00:50

On Thu, Nov 20, 2008 at 10:34 AM, Alex Richardson
<alexrichardson_at_[hidden]> wrote:
> I am still very new to boost build, so this question is probably
> rather trivial. I have a project using a Jamfile. My
> project needs to use a 3rd party library. From the documentation I
> found that I could use a standard lib target declaration, with a
> <file> statement:
> lib mythirdpartylib : : <file>third-party-lib.a ;
> This works fine as long as that library has already been built, but
> this library is available in source form, with a gnu makefile. I would
> really like to run that makefile to build the library when needed. I
> looked at some of the documentation on custom make rules, and came up
> with a naive solution along the lines of:
> make third-party-lib.flag : : @makelib ;
> actions makelib
> {
> ( cd $(LIBPATH) && make )
> touch $(<)
> }
> lib mythirdpartylib : third-party-lib.flag : <file>third-party-lib.a ;
> Unfortunately, the mythirdpartylib target fails because
> 'third-party-lib.a' does not exist. (It won't exist until after the
> 'makelib' action was run). It appears that the my
> "third-party-lib.flag" target does not get built before it evaluates
> the <file> statement.
> Is there a good/standard way to use 'makefile' based libraries from a Jamfile?

notfile : mythirdpartylib : @go_build_it

action go_build_it {
    make <whatever.>

You can also add a:

rule go_build_it ( sources * : targets * : properties * ) {
    define any make options here and then use them in your action

I can give a more complete example but this allows you to build your
third party library. Unfortunately Boost.Build does not manage this
dependency HOWEVER if you install it somewhere as part of the above,
you can then use the lib rule you mentioned to incorporate it into
your overall Boost.Build infrastructure as a dependency.

Let me know if you need more help and see here:

This is how I did it and it worked fine for me.

Hope this helps,


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at