 +NINJA_BASE = """\
 +builddir = $root/ninja
 +
-+cc = gcc
-+cxx = g++
++cc = ccache gcc
++cxx = ccache g++
 +
 +rule cc
 +  depfile = $out.d

+  def ComputeOutput(self, spec):
+    filename = self.ComputeOutputFileName(spec)
+
+    # Executables and loadable modules go into the output root.
+    if spec['type'] in ('executable', 'loadable_module'):
+      path = ''
+    elif spec['type'] == 'shared_library':
+      path = 'lib'
+    else:
+      # Everything else goes into our per-target dir.
+      path = self.base_dir
+
+    # XXX what are all these extra variables?
+    path = spec.get('product_dir', path)
+    assert 'product_prefix' not in spec
+    if 'product_name' in spec:
+      print 'XXX ignoring product_name'
+    assert 'product_extension' not in spec
+    #target_prefix = spec.get('product_prefix', target_prefix)
+    #target = spec.get('product_name', target)
+    #product_ext = spec.get('product_extension')
+
+    return '@' + os.path.join(path, filename)
+
+  def WriteRule(self, name, command, description=None):
+    self.WriteLn('rule %s' % name)

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