Home | History | Annotate | Download | only in gn
      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 "tools/gn/ninja_utils.h"
      6 
      7 #include "tools/gn/filesystem_utils.h"
      8 #include "tools/gn/settings.h"
      9 #include "tools/gn/target.h"
     10 
     11 SourceFile GetNinjaFileForTarget(const Target* target) {
     12   return SourceFile(GetTargetOutputDir(target).value() +
     13                     target->label().name() + ".ninja");
     14 }
     15 
     16 SourceFile GetNinjaFileForToolchain(const Settings* settings) {
     17   return SourceFile(GetToolchainOutputDir(settings).value() +
     18                     "toolchain.ninja");
     19 }
     20 
     21 std::string GetNinjaRulePrefixForToolchain(const Settings* settings) {
     22   // Don't prefix the default toolchain so it looks prettier, prefix everything
     23   // else.
     24   if (settings->is_default())
     25     return std::string();  // Default toolchain has no prefix.
     26   return settings->toolchain_label().name() + "_";
     27 }
     28