 +  'PRODUCT_DIR': '$b/',
 +  'SHARED_LIB_DIR': '$b/lib',
 +  'LIB_DIR': '$b/',
++
++  # Special variables that may be used by gyp 'rule' targets.
++  # We generate definitions for these variables on the fly when processing a
++  # rule.
 +  'RULE_INPUT_ROOT': '$root',
 +  'RULE_INPUT_PATH': '$source',
 +  'RULE_INPUT_EXT': '$ext',
 +  'RULE_INPUT_NAME': '$name',
-+
-+  # This appears unused --- ?
-+  'CONFIGURATION_NAME': '$(BUILDTYPE)',
 +}
 +
 +NINJA_BASE = """\
 +# Build directory.
-+b = ROOT_HACK/ninja
++b = ninja
 +
 +cc = ccache gcc
 +cxx = ccache g++

+    self.WriteLn()
+    return outputs
+
+  def WriteTarget(self, spec, config, link_deps):
+    # XXX only write these for rules that will use them
+    self.WriteVariableList('ldflags', config.get('ldflags'))
+    self.WriteVariableList('libs', spec.get('libraries'))

 
 # The "always run" action only counts to 2, but the dependent target will count
 # forever if it's allowed to run. This verifies that the dependent target only
@@ -33,7 +37,8 @@ test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
 # "always run" ran.
 test.build('actions.gyp', test.ALL, chdir='relocate/src')
 test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
