Boost logo

Boost-Build :

Subject: [Boost-build] Dependencies on generated header files
From: Trevor (trevor_at_[hidden])
Date: 2010-09-30 16:45:15

How do I let Boost.Build know about dependencies on generated header files?

I have a simple Jamfile that runs flex and bison, builds a library with the
output, and builds an executable with the library and a source file:

using bison ;
using lex ;
lib sql_parser : sql_lexer.ll sql_parser.yy : <link>static ;
exe sql_parser_test : main.cpp sql_parser ;

This works okay for non-parallel build (no -j option), but fails parallel
builds because dependencies on the generated header files don't seem to be
scanned. For example, main.cpp starts being compiled before flex or bison
are run to generate the sql_lexer.hpp and sql_parser.hpp files it includes.

sql_lexer.cpp includes sql_parser.hpp, sql_parser.cpp includes
sql_lexer.hpp, and main.cpp includes both. Therefore both flex and bison
need to run before any source files are compiled, but the dependencies to
guarantee this aren't there. Manually adding DEPENDS or INCLUDES rules
doesn't seem to help, but maybe there's a trick to correctly resolving the

I noticed this in qt4.jam:

            # Since this generator will return a H target, the linking
            # won't use it at all, and won't set any dependency on it.
            # we need the target to be seen by bjam, so that dependency from
            # sources to this generated header is detected -- if jam does
            # know about this target, it won't do anything.
            DEPENDS all : [ $(target).actualize ] ;

However, I'm not sure how to obtain the target object, since I don't have a
custom generator.

I'm using Boost.Build V2 (Milestone 12), Boost.Jam 03.1.17.


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