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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 out_ << std::endl; | 118 out_ << std::endl; |
119 | 119 |
120 WRITE_FLAGS(cflags) | 120 WRITE_FLAGS(cflags) |
121 WRITE_FLAGS(cflags_c) | 121 WRITE_FLAGS(cflags_c) |
122 WRITE_FLAGS(cflags_cc) | 122 WRITE_FLAGS(cflags_cc) |
123 WRITE_FLAGS(cflags_objc) | 123 WRITE_FLAGS(cflags_objc) |
124 WRITE_FLAGS(cflags_objcc) | 124 WRITE_FLAGS(cflags_objcc) |
125 | 125 |
126 #undef WRITE_FLAGS | 126 #undef WRITE_FLAGS |
127 | 127 |
| 128 // Write some variables about the target for the toolchain definition to use. |
| 129 out_ << "target_name = " << target_->label().name() << std::endl; |
| 130 out_ << "target_out_dir = "; |
| 131 path_output_.WriteDir(out_, helper_.GetTargetOutputDir(target_), |
| 132 PathOutput::DIR_NO_LAST_SLASH); |
128 out_ << std::endl; | 133 out_ << std::endl; |
| 134 out_ << "root_out_dir = "; |
| 135 path_output_.WriteDir(out_, target_->settings()->toolchain_output_subdir(), |
| 136 PathOutput::DIR_NO_LAST_SLASH); |
| 137 out_ << std::endl << std::endl; |
129 } | 138 } |
130 | 139 |
131 void NinjaBinaryTargetWriter::WriteSources( | 140 void NinjaBinaryTargetWriter::WriteSources( |
132 std::vector<OutputFile>* object_files) { | 141 std::vector<OutputFile>* object_files) { |
133 const Target::FileList& sources = target_->sources(); | 142 const Target::FileList& sources = target_->sources(); |
134 object_files->reserve(sources.size()); | 143 object_files->reserve(sources.size()); |
135 | 144 |
136 std::string implicit_deps = | 145 std::string implicit_deps = |
137 WriteInputDepsStampAndGetDep(std::vector<const Target*>()); | 146 WriteInputDepsStampAndGetDep(std::vector<const Target*>()); |
138 | 147 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 } | 467 } |
459 | 468 |
460 // Data files. | 469 // Data files. |
461 const std::vector<SourceFile>& data = target_->data(); | 470 const std::vector<SourceFile>& data = target_->data(); |
462 for (size_t i = 0; i < data.size(); i++) { | 471 for (size_t i = 0; i < data.size(); i++) { |
463 out_ << " "; | 472 out_ << " "; |
464 path_output_.WriteFile(out_, data[i]); | 473 path_output_.WriteFile(out_, data[i]); |
465 } | 474 } |
466 } | 475 } |
467 } | 476 } |
OLD | NEW |