I'm trying to automate a workflow with SCons where several scripts rely on a project file which in turn references several source files. Only the scripts have a real build action, there's nothing to to on the project; it just contains the file names.
In order to reduce redundancy, I would like to extract the name of the project file from the script files and to extract the names of the source files from the project file. I'm using a custom Scanner()
for this which works well and --tree=status
gives me the dependencies as I imagine them, i.e.
[E B C ]+-output.log
[E ] +-script.tcl
[E ] +-project.prj
[E C ] +-source1
[E C ] +-source2
(and so on for other scripts)
However if I touch a source file, no build action is triggered. I have played around with Depends()
, SideEffect()
and others, but I seem to misunderstand something here. The only workarounds I can think of right now are
Is there an other way to properly model this with SCons?
What you're searching for, is a custom Emitter for your Builder "prj->tcl". Have a look at http://scons.org/wiki/ToolsForFools for an example. You'll probably want to keep the list of "targets" untouched, but expand the "sources" based on the results of your scanning process. And yes, you have to scan within the Emitter...the Scanner would be the right place for implicit dependencies like C/C++ headers that operate across file/folder boundaries.