 +    # if any.
 +    self.prebuild_stamp = None
 +    if 'dependencies' in spec:
-+      for d in spec['dependencies']:
-+        dep = self.linkable_outputs.get(d)
-+        if dep:
-+          prebuild_deps.append(dep)
-+        dep = self.order_only_outputs.get(d)
-+        if dep:
-+          prebuild_deps.append(dep)
++      prebuild_deps = filter(None, [self.target_outputs.get(dep)
++                                    for dep in spec['dependencies']])
 +    if prebuild_deps:
 +      self.prebuild_stamp = self.StampPath('predepends')
 +      self.WriteEdge([self.prebuild_stamp], 'stamp', prebuild_deps,

===================================================================
--- 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.

+  all_outputs = set()
+
+  subninjas = set()
+  target_outputs = {}
+  target_links = {}
+  for qualified_target in target_list:
+    # qualified_target is like: third_party/icu/icu.gyp:icui18n#target
+    #OverPrint(qualified_target)
