summaryrefslogtreecommitdiffstats
path: root/tools/gn/ninja_helper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gn/ninja_helper.cc')
-rw-r--r--tools/gn/ninja_helper.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/gn/ninja_helper.cc b/tools/gn/ninja_helper.cc
index 6ddacd0..0ea93016 100644
--- a/tools/gn/ninja_helper.cc
+++ b/tools/gn/ninja_helper.cc
@@ -86,6 +86,19 @@ OutputFile NinjaHelper::GetOutputFileForSource(
name.append("res");
break;
+ // Pass .o/.obj files through unchanged.
+ case SOURCE_O: {
+ // System-absolute file names get preserved (they don't need to be
+ // rebased relative to the build dir).
+ if (source.is_system_absolute())
+ return OutputFile(source.value());
+
+ // Construct the relative location of the file from the build dir.
+ OutputFile ret(build_to_src_no_last_slash());
+ source.SourceAbsoluteWithOneSlash().AppendToString(&ret.value());
+ return ret;
+ }
+
case SOURCE_H:
case SOURCE_UNKNOWN:
NOTREACHED();
@@ -224,5 +237,7 @@ std::string NinjaHelper::GetRuleForSourceType(const Settings* settings,
// TODO(brettw) asm files.
+ // .obj files have no rules to make them (they're already built) so we return
+ // the enpty string for SOURCE_O.
return std::string();
}