 ===================================================================
 --- pylib/gyp/generator/ninja.py	(revision 0)
 +++ pylib/gyp/generator/ninja.py	(revision 0)
-@@ -0,0 +1,434 @@
+@@ -0,0 +1,463 @@
 +#!/usr/bin/python
 +
 +# Copyright (c) 2010 Google Inc. All rights reserved.

+
+      # For each source file, write an edge that generates all the outputs.
+      for source in rule.get('rule_sources', []):
+        outputs = []
+        for output in rule['outputs']:
+          basename = os.path.basename(source)
+          root = os.path.splitext(basename)[0]
+          outputs.append(output.replace('$root', root))
+        extra_bindings = []
+        for var in needed_variables:
+          if var == 'root':
+            extra_bindings.append(('root', root))
+          elif var == 'source':
+            extra_bindings.append(('source', source))
+          else:
+            assert var == None  # XXX Not yet implemented.
+        # XXX need to add extra dependencies on rule inputs
+        # (e.g. if generator program changes, we need to rerun)
+        self.WriteEdge(outputs, name, [self.FullPath(source)],

+  if '"' in arg or ' ' in arg:
+    return QuoteShellArgument(arg)
+  return arg
+
+def FixBuildDirPath(path):
+  """gyp doesn't know about our "@foo" syntax, and prepends paths to it."""
+  ofs = path.find('@')
+  if ofs > 0:
+    return path[ofs:]
+  return path
+
+class NinjaWriter:
+  def __init__(self, linkable_outputs, order_only_outputs, base_dir, path):
