2007-06-23

SCons 疑問

  • 次がうまく動作しない.
  • $ ls
    SConstruct src/
    $ ls src
    SConscript hello.c
    $ cat SConstruct
    SConscript('src/SConscript', build_dir = '../build')
    $ cat src/SConscript
    Program('hello', ['hello.c'])
    $ scons -Q
    scons: `.' is up to date.
    
  • 以下のようにすると動作する.
  • $ scons -Q ../build
    
  • どうやら,デフォルトターゲット . の子ターゲットとしてサブディレクトリは自動的に走査されるが,サブディレクトリでないものは走査されないようだ...[どこに記述があるんだろう?]
  • これは以下のようにして発見した.
  • $ scons -Q --taskmastertrace=-
    Taskmaster: '.': children:
        ['SConstruct', 'src']
        waiting on unstarted children:
        ['src']
    Taskmaster: 'src': children:
        ['src/SConscript']
        evaluating src
    Taskmaster: '.': children:
        ['SConstruct', 'src']
        evaluating .
    scons: `.' is up to date.
    Taskmaster: '.': already handled (up_to_date)
    
  • SconsProcessOverview - SCons Wiki に以下の記述がある.
  • command line arguments are "expanded" into a list of Nodes that we want built
          # if the argument is a directory, then everything within that directory is built
    
  • あるいは,UserGuide- SCons Wiki にあるように,src/SConscript で,
  • Default(Program('hello', ['hello.c'])
    

    とするほうがよい.