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_binary_target_writer.h" | 5 #include "tools/gn/ninja_binary_target_writer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 410 |
411 if (target_->inputs().size() == 0) | 411 if (target_->inputs().size() == 0) |
412 return OutputFile(); // No inputs | 412 return OutputFile(); // No inputs |
413 | 413 |
414 // If we only have one input, return it directly instead of writing a stamp | 414 // If we only have one input, return it directly instead of writing a stamp |
415 // file for it. | 415 // file for it. |
416 if (target_->inputs().size() == 1) | 416 if (target_->inputs().size() == 1) |
417 return OutputFile(settings_->build_settings(), target_->inputs()[0]); | 417 return OutputFile(settings_->build_settings(), target_->inputs()[0]); |
418 | 418 |
419 // Make a stamp file. | 419 // Make a stamp file. |
420 OutputFile input_stamp_file( | 420 OutputFile input_stamp_file = |
421 RebasePath(GetTargetOutputDir(target_).value(), | 421 GetBuildDirForTargetAsOutputFile(target_, BuildDirType::OBJ); |
422 settings_->build_settings()->build_dir(), | |
423 settings_->build_settings()->root_path_utf8())); | |
424 input_stamp_file.value().append(target_->label().name()); | 422 input_stamp_file.value().append(target_->label().name()); |
425 input_stamp_file.value().append(".inputs.stamp"); | 423 input_stamp_file.value().append(".inputs.stamp"); |
426 | 424 |
427 out_ << "build "; | 425 out_ << "build "; |
428 path_output_.WriteFile(out_, input_stamp_file); | 426 path_output_.WriteFile(out_, input_stamp_file); |
429 out_ << ": " | 427 out_ << ": " |
430 << GetNinjaRulePrefixForToolchain(settings_) | 428 << GetNinjaRulePrefixForToolchain(settings_) |
431 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP); | 429 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP); |
432 | 430 |
433 // File inputs. | 431 // File inputs. |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 out_ << " "; | 1030 out_ << " "; |
1033 path_output_.WriteFile(out_, non_linkable_dep->dependency_output_file()); | 1031 path_output_.WriteFile(out_, non_linkable_dep->dependency_output_file()); |
1034 } | 1032 } |
1035 } | 1033 } |
1036 } | 1034 } |
1037 | 1035 |
1038 OutputFile NinjaBinaryTargetWriter::GetWindowsPCHFile( | 1036 OutputFile NinjaBinaryTargetWriter::GetWindowsPCHFile( |
1039 Toolchain::ToolType tool_type) const { | 1037 Toolchain::ToolType tool_type) const { |
1040 // Use "obj/{dir}/{target_name}_{lang}.pch" which ends up | 1038 // Use "obj/{dir}/{target_name}_{lang}.pch" which ends up |
1041 // looking like "obj/chrome/browser/browser_cc.pch" | 1039 // looking like "obj/chrome/browser/browser_cc.pch" |
1042 OutputFile ret = GetTargetOutputDirAsOutputFile(target_); | 1040 OutputFile ret = GetBuildDirForTargetAsOutputFile(target_, BuildDirType::OBJ); |
1043 ret.value().append(target_->label().name()); | 1041 ret.value().append(target_->label().name()); |
1044 ret.value().push_back('_'); | 1042 ret.value().push_back('_'); |
1045 ret.value().append(GetPCHLangSuffixForToolType(tool_type)); | 1043 ret.value().append(GetPCHLangSuffixForToolType(tool_type)); |
1046 ret.value().append(".pch"); | 1044 ret.value().append(".pch"); |
1047 | 1045 |
1048 return ret; | 1046 return ret; |
1049 } | 1047 } |
1050 | 1048 |
1051 bool NinjaBinaryTargetWriter::CheckForDuplicateObjectFiles( | 1049 bool NinjaBinaryTargetWriter::CheckForDuplicateObjectFiles( |
1052 const std::vector<OutputFile>& files) const { | 1050 const std::vector<OutputFile>& files) const { |
(...skipping 14 matching lines...) Expand all Loading... |
1067 "\n" | 1065 "\n" |
1068 "In the latter case, either rename one of the files or move one of\n" | 1066 "In the latter case, either rename one of the files or move one of\n" |
1069 "the sources to a separate source_set to avoid them both being in\n" | 1067 "the sources to a separate source_set to avoid them both being in\n" |
1070 "the same target."); | 1068 "the same target."); |
1071 g_scheduler->FailWithError(err); | 1069 g_scheduler->FailWithError(err); |
1072 return false; | 1070 return false; |
1073 } | 1071 } |
1074 } | 1072 } |
1075 return true; | 1073 return true; |
1076 } | 1074 } |
OLD | NEW |