title: Scons Explicit Dependency
body: <p>I have a simple <code>.cpp</code> file that depends on <code>jsoncpp</code>. As a part of my build process I want Scons to untar jsoncpp (if it isn't already) and build it (if it isn't already) before attempting to compile <code>app.cpp</code> since <code>app.cpp</code> depends on some <code>.h</code> files that are zipped up inside of <code>jsoncpp.tar.gz</code>.</p>
  
  <p>This is what I've tried so far:</p>
  
  <pre><code>env = Environment()
  env.Program('app', 'app.cpp')
  env.Depends('app.cpp', 'jsoncpp')
  
  def build_jsoncpp(target, source, env):
      shutil.rmtree("jsoncpp", ignore_errors=True)
      mytar = tarfile.open(str(source[0]))
      mytar.extractall()
      print("Extracted jsoncpp")
  
  env.Command("jsoncpp", ['jsoncpp.tar.gz'], build_jsoncpp)
  </code></pre>
  
  <p>However, Scons never prints "Extracted jsoncpp"... it always attempts to compile app.cpp and then promptly fails.</p>
  
  <p>If I were using <code>make</code>, I could simply do something like:</p>
  
  <pre><code>app: jsoncpp.tar.gz
      # Build app
  
  jsoncpp.tar.gz:
      # Extract and build here
  </code></pre>
  
  <p>And the order would be guaranteed.</p>