ok, first some skinson clarifications. Scons has two phases when building. First, in the analysis phase, all Scons scripts are executed, and the result is a static dependency tree that describes the source and target files for all developers defined in the scripts. Further, on the basis of this tree, the assembly database from the last assembly and the signing of files on the disk, all developers with outdated goals are restored.
Now to your question. If you only want to run generate when necessary (when generate or the configuration files change), then running generate as part of the analysis phase is out of the question. Therefore, do not use Execute() . Instead, generate should be the owner. So far so good.
Now you have two collectors: the first builder generate and the second builder, I call it buildObject . buildObject depends on the goals of generate , but, as you say, generate targets are unknown during analysis (since generate does not start, it is configured only as a builder). Having unknown targets during analysis is a classic challenge with SCons, and there is no easy way to solve it.
I usually solve it using what I call the SCons.pleaser file. In your case, this will be a known target created by generate containing a high-resolution timestamp. Then the creator of buildObject takes this file as the source. Now, if your configuration files have not changed, generate will not start, SCons.pleaser will not change, and buildObject will not buildObject . If you change the configuration files, generate, it starts, SCons.pleaser changes and buildObject also starts.
Hi
KlausCPH
source share