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_helper.h" | 5 #include "tools/gn/ninja_helper.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "tools/gn/filesystem_utils.h" | 9 #include "tools/gn/filesystem_utils.h" |
10 #include "tools/gn/string_utils.h" | 10 #include "tools/gn/string_utils.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } else { | 173 } else { |
174 extension = target->output_extension().c_str(); | 174 extension = target->output_extension().c_str(); |
175 } | 175 } |
176 | 176 |
177 // Everything goes into the toolchain directory (which will be empty for the | 177 // Everything goes into the toolchain directory (which will be empty for the |
178 // default toolchain, and will end in a slash otherwise). | 178 // default toolchain, and will end in a slash otherwise). |
179 ret.value().append(target->settings()->toolchain_output_subdir().value()); | 179 ret.value().append(target->settings()->toolchain_output_subdir().value()); |
180 | 180 |
181 // Binaries and loadable libraries go into the toolchain root. | 181 // Binaries and loadable libraries go into the toolchain root. |
182 if (target->output_type() == Target::EXECUTABLE || | 182 if (target->output_type() == Target::EXECUTABLE || |
183 (target->settings()->IsMac() && | 183 ((target->settings()->IsMac() || target->settings()->IsWin()) && |
184 (target->output_type() == Target::SHARED_LIBRARY || | |
185 target->output_type() == Target::STATIC_LIBRARY)) || | |
186 (target->settings()->IsWin() && | |
187 target->output_type() == Target::SHARED_LIBRARY)) { | 184 target->output_type() == Target::SHARED_LIBRARY)) { |
188 // Generate a name like "<toolchain>/<prefix><name>.<extension>". | 185 // Generate a name like "<toolchain>/<prefix><name>.<extension>". |
189 ret.value().append(prefix); | 186 ret.value().append(prefix); |
190 ret.value().append(name); | 187 ret.value().append(name); |
191 if (extension[0]) { | 188 if (extension[0]) { |
192 ret.value().push_back('.'); | 189 ret.value().push_back('.'); |
193 ret.value().append(extension); | 190 ret.value().append(extension); |
194 } | 191 } |
195 return ret; | 192 return ret; |
196 } | 193 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 return prefix + "rc"; | 246 return prefix + "rc"; |
250 if (type == SOURCE_S) | 247 if (type == SOURCE_S) |
251 return prefix + "cc"; // Assembly files just get compiled by CC. | 248 return prefix + "cc"; // Assembly files just get compiled by CC. |
252 | 249 |
253 // TODO(brettw) asm files. | 250 // TODO(brettw) asm files. |
254 | 251 |
255 // .obj files have no rules to make them (they're already built) so we return | 252 // .obj files have no rules to make them (they're already built) so we return |
256 // the enpty string for SOURCE_O. | 253 // the enpty string for SOURCE_O. |
257 return std::string(); | 254 return std::string(); |
258 } | 255 } |
OLD | NEW |