 +    outputs = []
 +    for copy in copies:
 +      for path in copy['files']:
++        # Normalize the path so trailing slashes don't confuse us.
++        path = os.path.normpath(path)
 +        filename = os.path.split(path)[1]
 +        src = self.InputPath(path)
-+        dst = self.OutputPath(os.path.join(copy['destination'], filename))
++        # See discussion of InputPath in WriteActions for why we use it here.
++        dst = self.InputPath(os.path.join(copy['destination'], filename))
 +        self.WriteEdge([dst], 'copy', [src])
 +        outputs.append(dst)
 +

+rule cc
+  depfile = $out.d
+  description = CC $out
+  command = $cc -MMD -MF $out.d $cflags $cflags_cc $defines $includes \\
+    -c $in -o $out
+
+rule cxx
+  depfile = $out.d
+  description = CXX $out
+  command = $cxx -MMD -MF $out.d $cflags $cflags_cxx $defines $includes \\
+    -c $in -o $out
+
+rule alink

+
+    output, output_link_deps = writer.WriteSpec(spec, config)
+    if output:
+      target_outputs[qualified_target] = output
+
+      if qualified_target in all_targets:
