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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "tools/gn/config_values_extractors.h" | 10 #include "tools/gn/config_values_extractors.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 std::vector<OutputFile> tool_outputs; // Prevent allocation in loop. | 416 std::vector<OutputFile> tool_outputs; // Prevent allocation in loop. |
417 for (size_t i = 0; i < dep->sources().size(); i++) { | 417 for (size_t i = 0; i < dep->sources().size(); i++) { |
418 Toolchain::ToolType tool_type = Toolchain::TYPE_NONE; | 418 Toolchain::ToolType tool_type = Toolchain::TYPE_NONE; |
419 if (GetOutputFilesForSource(dep, dep->sources()[i], &tool_type, | 419 if (GetOutputFilesForSource(dep, dep->sources()[i], &tool_type, |
420 &tool_outputs)) { | 420 &tool_outputs)) { |
421 // Only link the first output if there are more than one. | 421 // Only link the first output if there are more than one. |
422 extra_object_files->push_back(tool_outputs[0]); | 422 extra_object_files->push_back(tool_outputs[0]); |
423 } | 423 } |
424 } | 424 } |
425 } | 425 } |
| 426 } else if (target_->complete_static_lib() && dep->IsFinal()) { |
| 427 non_linkable_deps->push_back(dep); |
426 } else if (can_link_libs && dep->IsLinkable()) { | 428 } else if (can_link_libs && dep->IsLinkable()) { |
427 linkable_deps->push_back(dep); | 429 linkable_deps->push_back(dep); |
428 } else { | 430 } else { |
429 non_linkable_deps->push_back(dep); | 431 non_linkable_deps->push_back(dep); |
430 } | 432 } |
431 } | 433 } |
432 | 434 |
433 void NinjaBinaryTargetWriter::WriteOrderOnlyDependencies( | 435 void NinjaBinaryTargetWriter::WriteOrderOnlyDependencies( |
434 const UniqueVector<const Target*>& non_linkable_deps) { | 436 const UniqueVector<const Target*>& non_linkable_deps) { |
435 const std::vector<SourceFile>& data = target_->data(); | 437 const std::vector<SourceFile>& data = target_->data(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 return false; // No tool for this file (it's a header file or something). | 470 return false; // No tool for this file (it's a header file or something). |
469 const Tool* tool = target->toolchain()->GetTool(*computed_tool_type); | 471 const Tool* tool = target->toolchain()->GetTool(*computed_tool_type); |
470 if (!tool) | 472 if (!tool) |
471 return false; // Tool does not apply for this toolchain.file. | 473 return false; // Tool does not apply for this toolchain.file. |
472 | 474 |
473 // Figure out what output(s) this compiler produces. | 475 // Figure out what output(s) this compiler produces. |
474 SubstitutionWriter::ApplyListToCompilerAsOutputFile( | 476 SubstitutionWriter::ApplyListToCompilerAsOutputFile( |
475 target, source, tool->outputs(), outputs); | 477 target, source, tool->outputs(), outputs); |
476 return !outputs->empty(); | 478 return !outputs->empty(); |
477 } | 479 } |
OLD | NEW |