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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/strings/stringize_macros.h" | 10 #include "base/strings/stringize_macros.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // GCC-style deps require a depfile. | 98 // GCC-style deps require a depfile. |
99 if (!tool->depfile().empty()) { | 99 if (!tool->depfile().empty()) { |
100 WriteRulePattern("depfile", tool->depfile(), options); | 100 WriteRulePattern("depfile", tool->depfile(), options); |
101 out_ << kIndent << "deps = gcc" << std::endl; | 101 out_ << kIndent << "deps = gcc" << std::endl; |
102 } | 102 } |
103 } else if (tool->depsformat() == Tool::DEPS_MSVC) { | 103 } else if (tool->depsformat() == Tool::DEPS_MSVC) { |
104 // MSVC deps don't have a depfile. | 104 // MSVC deps don't have a depfile. |
105 out_ << kIndent << "deps = msvc" << std::endl; | 105 out_ << kIndent << "deps = msvc" << std::endl; |
106 } | 106 } |
107 | 107 |
108 if (!tool->pool().empty()) | 108 // The link pool applies to linker tools. Don't count TYPE_ALINK since |
109 out_ << kIndent << "pool = " << tool->pool() << std::endl; | 109 // static libraries are not generally intensive to write. |
| 110 if (type == Toolchain::TYPE_SOLINK || type == Toolchain::TYPE_LINK) |
| 111 out_ << kIndent << "pool = link_pool\n"; |
| 112 |
110 if (tool->restat()) | 113 if (tool->restat()) |
111 out_ << kIndent << "restat = 1" << std::endl; | 114 out_ << kIndent << "restat = 1" << std::endl; |
112 } | 115 } |
113 | 116 |
114 void NinjaToolchainWriter::WriteRulePattern(const char* name, | 117 void NinjaToolchainWriter::WriteRulePattern(const char* name, |
115 const SubstitutionPattern& pattern, | 118 const SubstitutionPattern& pattern, |
116 const EscapeOptions& options) { | 119 const EscapeOptions& options) { |
117 if (pattern.empty()) | 120 if (pattern.empty()) |
118 return; | 121 return; |
119 out_ << kIndent << name << " = "; | 122 out_ << kIndent << name << " = "; |
120 SubstitutionWriter::WriteWithNinjaVariables(pattern, options, out_); | 123 SubstitutionWriter::WriteWithNinjaVariables(pattern, options, out_); |
121 out_ << std::endl; | 124 out_ << std::endl; |
122 } | 125 } |
123 | 126 |
124 void NinjaToolchainWriter::WriteSubninjas() { | 127 void NinjaToolchainWriter::WriteSubninjas() { |
125 // Write subninja commands for each generated target. | 128 // Write subninja commands for each generated target. |
126 for (size_t i = 0; i < targets_.size(); i++) { | 129 for (size_t i = 0; i < targets_.size(); i++) { |
127 OutputFile ninja_file(targets_[i]->settings()->build_settings(), | 130 OutputFile ninja_file(targets_[i]->settings()->build_settings(), |
128 GetNinjaFileForTarget(targets_[i])); | 131 GetNinjaFileForTarget(targets_[i])); |
129 out_ << "subninja "; | 132 out_ << "subninja "; |
130 path_output_.WriteFile(out_, ninja_file); | 133 path_output_.WriteFile(out_, ninja_file); |
131 out_ << std::endl; | 134 out_ << std::endl; |
132 } | 135 } |
133 out_ << std::endl; | 136 out_ << std::endl; |
134 } | 137 } |
OLD | NEW |