 +    sources = spec.get('sources', []) + extra_sources
 +    if sources:
 +      link_deps = self.WriteSources(config, sources, sources_predepends)
++      # Some actions/rules output 'sources' that are already object files.
++      link_deps += [f for f in sources if f.endswith('.o')]
 +
 +    # The final output of our target depends on the last output of the
 +    # above steps.

+*.pyc
diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py
new file mode 100644
index 0000000..82992d9
--- /dev/null
+++ b/pylib/gyp/generator/ninja.py
@@ -0,0 +1,542 @@
+#!/usr/bin/python
+
+# Copyright (c) 2010 Google Inc. All rights reserved.

+}
+
+NINJA_BASE = """\
+builddir = ninja
+# Short alias for builddir.
+b = ninja
+
+cc = %(cc)s
