[jamming] Problem with header file scanning and updates
peter.klotz at aon.at
Mon Feb 10 22:52:52 PST 2003
> My theory is that the problem is caused by "grist."
> I see that you are using grist (FGristFiles) in your UicR rule. If
> you are using SubDir, then FGristFiles will cause each directory in
> your project to have different grist added to the targets.
> So your UicR rule will create a target something like <a!b!c>base.hpp.
That is exactly what I meant to do. There could be several
base.ui/derived.cpp/derived.hpp files in different directories.
> So you end up with <a!b!c>base.hpp and base.hpp -- two Jam targets
> that reference the same file.
A bad situation.
> You can check if this is happening by running
> jam -d5 | egrep '(base.hpp|derived.cpp)'
> You'll see calls to Depends and Includes that set up the dependency
> tree. You'll probably find that the base.hpp included by derived.cpp
> has no grist, but the base.hpp generated by your custom rule has
Yes, I find the following:
>>>>|>>>>|>> Includes <PROJECTS!Applications!JamTest>base.cpp :
>>>> Includes <PROJECTS!Applications!JamTest>derived.cpp : derived.hpp
>>>> Includes derived.hpp : base.hpp
> There are three solutions (probably more):
> 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.
> 2) Turn off grist. Do this by setting the SOURCE_GRIST variable to
> nothing after every SubDir call.
> SubDir TOP foo ;
> SOURCE_GRIST = ;
> This assumes that no two directories in your project will ever have
> files with the same name.
This is impossible, since the project is spread across several directories
(each containing a static library) and I extensively use grist.
> 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.
Thank you very much for the detailed explanation.
Best regards, Peter.
More information about the jamming