开发者

SCONS: making a special script builder depend on output of another builder

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...


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜