[Scons-users] How to let the action of a custom builder run before the emitters of dependent builders

Dirk Bächle tshortik at gmx.de
Sat Sep 13 05:59:53 EDT 2014


Hi Rocco,

On 13.09.2014 11:11, getspammed wrote:
> I have a custom builder that takes some input files and creates 
> several output files of different types - this is a code generation 
> step. That builder has an emitter and an action.
> In addition to that, there are several more custom and builtin 
> builders that consume the generated files. Those additional custom 
> builders also have emitters.
>
> My problem is this:
>
> In order to reason about what will be the sources and targets, the 
> emitters of the secondary builders have to read the generated files. 
> But they cannot do so, because scons seems to always run ALL the 
> emitters FIRST - before the generator creates any files. Only AFTER 
> that scons seems to run the required actions - which will create the 
> required files too late.
>
the mechanism that usually solves these kind of problems in SCons are 
Scanners. For C/C++ the default scanner will add *.h files as implicit 
dependencies to your object files, along the sources, even if they get 
auto-generated during the build.
So, you'd have to define a custom scanner that is able to detect the 
dependencies from your "first" to the "second" build stage. This can get 
tricky depending on what file suffixes, and file types in general, are 
involved.
Can you tell us a bit more about your project in this direction? For 
example, when parsing a file from the "first" stage, how do you detect 
that another file depends on it?

Best regards,

Dirk



More information about the Scons-users mailing list