| 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 "tools/gn/filesystem_utils.h" | 8 #include "tools/gn/filesystem_utils.h" |
| 9 #include "tools/gn/string_utils.h" | 9 #include "tools/gn/string_utils.h" |
| 10 #include "tools/gn/target.h" | 10 #include "tools/gn/target.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 const char kLibDirWithSlash[] = "lib"; | 14 const char kLibDirWithSlash[] = "lib/"; |
| 15 const char kObjectDirNoSlash[] = "obj"; | 15 const char kObjectDirNoSlash[] = "obj"; |
| 16 | 16 |
| 17 } // namespace | 17 } // namespace |
| 18 | 18 |
| 19 NinjaHelper::NinjaHelper(const BuildSettings* build_settings) | 19 NinjaHelper::NinjaHelper(const BuildSettings* build_settings) |
| 20 : build_settings_(build_settings) { | 20 : build_settings_(build_settings) { |
| 21 build_to_src_no_last_slash_ = build_settings->build_to_source_dir_string(); | 21 build_to_src_no_last_slash_ = build_settings->build_to_source_dir_string(); |
| 22 if (!build_to_src_no_last_slash_.empty() && | 22 if (!build_to_src_no_last_slash_.empty() && |
| 23 build_to_src_no_last_slash_[build_to_src_no_last_slash_.size() - 1] == | 23 build_to_src_no_last_slash_[build_to_src_no_last_slash_.size() - 1] == |
| 24 '/') | 24 '/') |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 OutputFile NinjaHelper::GetTargetOutputFile(const Target* target) const { | 110 OutputFile NinjaHelper::GetTargetOutputFile(const Target* target) const { |
| 111 OutputFile ret; | 111 OutputFile ret; |
| 112 if (target->output_type() == Target::NONE) { | 112 if (target->output_type() == Target::NONE) { |
| 113 NOTREACHED(); | 113 NOTREACHED(); |
| 114 return ret; | 114 return ret; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // This is prepended to the output file name. | 117 // This is prepended to the output file name. |
| 118 const char* prefix; | 118 const char* prefix; |
| 119 if (target->settings()->IsWin()) { | 119 if (target->settings()->IsWin() || |
| 120 target->output_type() == Target::EXECUTABLE) { |
| 120 prefix = ""; | 121 prefix = ""; |
| 121 } else { | 122 } else { |
| 122 prefix = "lib"; | 123 prefix = "lib"; |
| 123 } | 124 } |
| 124 | 125 |
| 125 const char* extension; | 126 const char* extension; |
| 126 if (target->output_type() == Target::NONE || | 127 if (target->output_type() == Target::NONE || |
| 127 target->output_type() == Target::COPY_FILES || | 128 target->output_type() == Target::COPY_FILES || |
| 128 target->output_type() == Target::CUSTOM) { | 129 target->output_type() == Target::CUSTOM) { |
| 129 extension = "stamp"; | 130 extension = "stamp"; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 ret.value().append(kObjectDirNoSlash); | 173 ret.value().append(kObjectDirNoSlash); |
| 173 AppendStringPiece(&ret.value(), | 174 AppendStringPiece(&ret.value(), |
| 174 target->label().dir().SourceAbsoluteWithOneSlash()); | 175 target->label().dir().SourceAbsoluteWithOneSlash()); |
| 175 ret.value().append(target->label().name()); | 176 ret.value().append(target->label().name()); |
| 176 if (extension[0]) { | 177 if (extension[0]) { |
| 177 ret.value().push_back('.'); | 178 ret.value().push_back('.'); |
| 178 ret.value().append(extension); | 179 ret.value().append(extension); |
| 179 } | 180 } |
| 180 return ret; | 181 return ret; |
| 181 } | 182 } |
| OLD | NEW |