[jamming] Problem with header file scanning and updates

Matt Armstrong matt at lickey.com
Tue Feb 11 07:55:14 PST 2003

"Peter Klotz" <peter.klotz at aon.at> writes:

> Yes, I find the following:
>>>>>|>>>>|>> Includes <PROJECTS!Applications!JamTest>base.cpp  :
> <PROJECTS!Applications!JamTest>base.hpp
>>>>> Includes <PROJECTS!Applications!JamTest>derived.cpp  : derived.hpp
>>>>> Includes derived.hpp  : base.hpp

And there you have it!  :-)

>> 1) Explicitly set up the dependency in your Jamfile:
>>     Includes base.hpp : <a!b!c>base.hpp ;
>>    This second one tricks Jam into thinking base.hpp (the one
>>    discovered at header scan time) "includes" <a!b!c>base.hpp (the one
>>    generated by your rule), so any file including base.hpp (namely,
>>    derived.cpp) will end up depending on <a!b!c>base.hpp.
> Sounds very good. Since all my Jamfiles are generated automatically
> this is not a problem to do.  It already works in my test case.


>> 3) Use FGristSourceFiles in your UicR rule.  Add a modified version of
>>    Jambase' FGristSourceFiles rule to your Jamrules.  The modified
>>    version will not add grist to .hpp files, just as the stock Jambase
>>    version does not add grist to .h files.
>>    This assumes that your project will never have two .hpp files with
>>    the same name in different directories.
> I am not able to guarantee that. Different developers tend to
> produce files with identical names.

Note that solution #1 will result in too many things being compiled
sometimes.  If you have multiple base.hpp files in the project, Jam
will see a series of this:

    Includes base.hpp : <a!b!c>base.hpp ;
    Includes base.hpp : <d!e!f>base.hpp ;
    Includes base.hpp : <h!i!j>base.hpp ;

And any file including a "base.hpp" will depend on all of the
generated base.hpp files.

But at least compiling too much is not as bad as what you had before.


More information about the jamming mailing list