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