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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 // should also have been collected via the input deps stamp that each source | 772 // should also have been collected via the input deps stamp that each source |
773 // file has for an order-only dependency, and since this target depends on | 773 // file has for an order-only dependency, and since this target depends on |
774 // the sources, there is already an implicit order-only dependency. However, | 774 // the sources, there is already an implicit order-only dependency. However, |
775 // it's extra work to separate these out and there's no disadvantage to | 775 // it's extra work to separate these out and there's no disadvantage to |
776 // listing them again. | 776 // listing them again. |
777 WriteOrderOnlyDependencies(non_linkable_deps); | 777 WriteOrderOnlyDependencies(non_linkable_deps); |
778 | 778 |
779 // End of the link "build" line. | 779 // End of the link "build" line. |
780 out_ << std::endl; | 780 out_ << std::endl; |
781 | 781 |
782 // These go in the inner scope of the link line. | 782 // The remaining things go in the inner scope of the link line. |
783 WriteLinkerFlags(optional_def_file); | 783 if (target_->output_type() == Target::EXECUTABLE || |
784 | 784 target_->output_type() == Target::SHARED_LIBRARY || |
785 WriteLibs(); | 785 target_->output_type() == Target::LOADABLE_MODULE) { |
| 786 WriteLinkerFlags(optional_def_file); |
| 787 WriteLibs(); |
| 788 } |
786 WriteOutputExtension(); | 789 WriteOutputExtension(); |
787 WriteSolibs(solibs); | 790 WriteSolibs(solibs); |
788 } | 791 } |
789 | 792 |
790 void NinjaBinaryTargetWriter::WriteLinkerFlags( | 793 void NinjaBinaryTargetWriter::WriteLinkerFlags( |
791 const SourceFile* optional_def_file) { | 794 const SourceFile* optional_def_file) { |
792 out_ << " ldflags ="; | 795 out_ << " ldflags ="; |
793 | 796 |
794 // First the ldflags from the target and its config. | 797 // First the ldflags from the target and its config. |
795 EscapeOptions flag_options = GetFlagOptions(); | 798 EscapeOptions flag_options = GetFlagOptions(); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 "\n" | 1004 "\n" |
1002 "In the latter case, either rename one of the files or move one of\n" | 1005 "In the latter case, either rename one of the files or move one of\n" |
1003 "the sources to a separate source_set to avoid them both being in\n" | 1006 "the sources to a separate source_set to avoid them both being in\n" |
1004 "the same target."); | 1007 "the same target."); |
1005 g_scheduler->FailWithError(err); | 1008 g_scheduler->FailWithError(err); |
1006 return false; | 1009 return false; |
1007 } | 1010 } |
1008 } | 1011 } |
1009 return true; | 1012 return true; |
1010 } | 1013 } |
OLD | NEW |