OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/gn/ninja_toolchain_writer.h" | 5 #include "tools/gn/ninja_toolchain_writer.h" |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/strings/stringize_macros.h" | 10 #include "base/strings/stringize_macros.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 WriteRulePattern("depfile", tool->depfile(), options); | 102 WriteRulePattern("depfile", tool->depfile(), options); |
103 out_ << kIndent << "deps = gcc" << std::endl; | 103 out_ << kIndent << "deps = gcc" << std::endl; |
104 } | 104 } |
105 } else if (tool->depsformat() == Tool::DEPS_MSVC) { | 105 } else if (tool->depsformat() == Tool::DEPS_MSVC) { |
106 // MSVC deps don't have a depfile. | 106 // MSVC deps don't have a depfile. |
107 out_ << kIndent << "deps = msvc" << std::endl; | 107 out_ << kIndent << "deps = msvc" << std::endl; |
108 } | 108 } |
109 | 109 |
110 // The link pool applies to linker tools. Don't count TYPE_ALINK since | 110 // The link pool applies to linker tools. Don't count TYPE_ALINK since |
111 // static libraries are not generally intensive to write. | 111 // static libraries are not generally intensive to write. |
112 if (type == Toolchain::TYPE_SOLINK || type == Toolchain::TYPE_LINK) | 112 if (type == Toolchain::TYPE_SOLINK |
113 || type == Toolchain::TYPE_SOLINK_MODULE | |
brettw
2015/10/13 23:13:33
|| goes at end-of-line
Bons
2015/10/13 23:30:52
Done.
| |
114 || type == Toolchain::TYPE_LINK) { | |
113 out_ << kIndent << "pool = link_pool\n"; | 115 out_ << kIndent << "pool = link_pool\n"; |
116 } | |
114 | 117 |
115 if (tool->restat()) | 118 if (tool->restat()) |
116 out_ << kIndent << "restat = 1" << std::endl; | 119 out_ << kIndent << "restat = 1" << std::endl; |
117 } | 120 } |
118 | 121 |
119 void NinjaToolchainWriter::WriteRulePattern(const char* name, | 122 void NinjaToolchainWriter::WriteRulePattern(const char* name, |
120 const SubstitutionPattern& pattern, | 123 const SubstitutionPattern& pattern, |
121 const EscapeOptions& options) { | 124 const EscapeOptions& options) { |
122 if (pattern.empty()) | 125 if (pattern.empty()) |
123 return; | 126 return; |
124 out_ << kIndent << name << " = "; | 127 out_ << kIndent << name << " = "; |
125 SubstitutionWriter::WriteWithNinjaVariables(pattern, options, out_); | 128 SubstitutionWriter::WriteWithNinjaVariables(pattern, options, out_); |
126 out_ << std::endl; | 129 out_ << std::endl; |
127 } | 130 } |
128 | 131 |
129 void NinjaToolchainWriter::WriteSubninjas() { | 132 void NinjaToolchainWriter::WriteSubninjas() { |
130 // Write subninja commands for each generated target. | 133 // Write subninja commands for each generated target. |
131 for (const auto& target : targets_) { | 134 for (const auto& target : targets_) { |
132 OutputFile ninja_file(target->settings()->build_settings(), | 135 OutputFile ninja_file(target->settings()->build_settings(), |
133 GetNinjaFileForTarget(target)); | 136 GetNinjaFileForTarget(target)); |
134 out_ << "subninja "; | 137 out_ << "subninja "; |
135 path_output_.WriteFile(out_, ninja_file); | 138 path_output_.WriteFile(out_, ninja_file); |
136 out_ << std::endl; | 139 out_ << std::endl; |
137 } | 140 } |
138 out_ << std::endl; | 141 out_ << std::endl; |
139 } | 142 } |
OLD | NEW |