tags:

views:

67

answers:

1

I hope the title clarifies what I want to ask because it is a bit tricky.

I have a SCONS SConscript for every subdir as follows (doing it in linux, if it matters):

  • src_dir
    • compiler
      • SConscript
      • yacc srcs
    • scripts
      • legacy_script
    • data
      • SConscript
      • data files for the yacc

I use a variant_dir without copy, for example:
SConscript('src_dir/compiler/SConscript', variant_dir = 'obj_dir', duplicate = 0)

The resulting obj_dir after building the yacc is:

  • obj_dir
    • compiler
      • compiler_compiler.exe

Now here is the deal.
I have another SConscript in the data dir that needs to do 2 things: 1. compile the data with the yacc compiled compiler
2. Take the output of the compiler and run it with the legacy_script I can't change
(the legacy_script, takes the output of the compiled data and build some h files for another software to depend on)

number 1 is acheived easily:
linux_env.Command('[output1, output2]', 'data/data_files','compiler_compiler.exe data_files output1 output2')

my problem is number 2: How do I make the script runner depend on outputs of another target
And just to clarify it, I need to make SCONS run (and only if compiler_output changes):
src_dir/script/legacy_script obj_dir/data/compiler_output obj_dir/some_dir/script_output
(the script is usage is: legacy_script input_file output_file)

I hope I made myself clear, feel free to ask some more questions...

A: 

Hi,

I've had a similar problem recently when I needed to compile Cheetah Templates first, which were then used from another Builder to generate HTML files from different sources.

If you define the build output of the first builder as source for the second builder, SCons will run them in the correct order and only if intermediate files have changed.

Wolfgang

Wolfgang Ulmer
yeah, but the Command builder should be in the SConscript of the legacy_script, and it's src is in the obj directory created by another SConscript, so how do I tell him that the src is there?
James Katz
Use `#obj_dir/data/compiler_output` to refer to the generated output and use that file as source for `#obj_dir/some_dir/script_output`.
Wolfgang Ulmer
It worked! thank's
James Katz