OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_utils.h" | 5 #include "tools/gn/ninja_utils.h" |
6 | 6 |
7 #include "tools/gn/filesystem_utils.h" | 7 #include "tools/gn/filesystem_utils.h" |
8 #include "tools/gn/settings.h" | 8 #include "tools/gn/settings.h" |
9 #include "tools/gn/target.h" | 9 #include "tools/gn/target.h" |
10 | 10 |
11 SourceFile GetNinjaFileForTarget(const Target* target) { | 11 SourceFile GetNinjaFileForTarget(const Target* target) { |
12 return SourceFile(GetTargetOutputDir(target).value() + | 12 return SourceFile( |
13 target->label().name() + ".ninja"); | 13 GetBuildDirForTargetAsSourceDir(target, BuildDirType::OBJ).value() + |
| 14 target->label().name() + ".ninja"); |
14 } | 15 } |
15 | 16 |
16 SourceFile GetNinjaFileForToolchain(const Settings* settings) { | 17 SourceFile GetNinjaFileForToolchain(const Settings* settings) { |
17 return SourceFile(GetToolchainOutputDir(settings).value() + | 18 return SourceFile(GetBuildDirAsSourceDir( |
18 "toolchain.ninja"); | 19 BuildDirContext(settings), BuildDirType::TOOLCHAIN_ROOT).value() + |
| 20 "toolchain.ninja"); |
19 } | 21 } |
20 | 22 |
21 std::string GetNinjaRulePrefixForToolchain(const Settings* settings) { | 23 std::string GetNinjaRulePrefixForToolchain(const Settings* settings) { |
22 // Don't prefix the default toolchain so it looks prettier, prefix everything | 24 // Don't prefix the default toolchain so it looks prettier, prefix everything |
23 // else. | 25 // else. |
24 if (settings->is_default()) | 26 if (settings->is_default()) |
25 return std::string(); // Default toolchain has no prefix. | 27 return std::string(); // Default toolchain has no prefix. |
26 return settings->toolchain_label().name() + "_"; | 28 return settings->toolchain_label().name() + "_"; |
27 } | 29 } |
OLD | NEW |