Serbin
Serbin

Reputation: 823

Scons build order

We have two tools: Tool1 and Tool2. Tool1 create some TargetFile, based on the SourceFile. Now we want to use TargetFile int the Tool2 to create another NewTargetFile. Structure is similar to this:

   env.Tool1(TargetFile, SourceFile)
   env.Tool2(NewTargetFile, TargetFile)

Emitter of the Tool2 is using TargetFile to do some magis. As result, Scons says that it can't open TargetFile (because it wasn't builded yet).

How to make so, that Scons will build Tool1 before Tool2?

Upvotes: 0

Views: 785

Answers (1)

dirkbaechle
dirkbaechle

Reputation: 4052

You should be able to use the return value of the first call (a Node or a list of Nodes) as input to the second call:

res = env.Tool1(TargetFile, SourceFile)
env.Tool2(NewTargetFile, res)

This should create the required dependency automatically. Usually, specifying a simple filename as string, like "foo.in", for TargetFile should work too. But I'm guessing that your Emitter is doing tricks and returning additional filenames, or a completely different filename than TargetFile instead. You may want to check the return value with:

res = env.Tool1(TargetFile, SourceFile)
print map(str, res)
env.Tool2(NewTargetFile, res)

, or similar.

Upvotes: 1

Related Questions