Ninja: Add a convenient 'help' target.

This commit is contained in:
Nicolas Despres 2012-04-19 17:07:35 +02:00 committed by Peter Kuemmel
parent 3bd41f2eb5
commit 92cee7626c
2 changed files with 22 additions and 0 deletions

View File

@ -755,6 +755,7 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
this->WriteTargetAll(os); this->WriteTargetAll(os);
this->WriteTargetRebuildManifest(os); this->WriteTargetRebuildManifest(os);
this->WriteTargetClean(os); this->WriteTargetClean(os);
this->WriteTargetHelp(os);
} }
void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os) void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os)
@ -841,3 +842,23 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
/*orderOnlyDeps=*/ cmNinjaDeps(), /*orderOnlyDeps=*/ cmNinjaDeps(),
/*variables=*/ cmNinjaVars()); /*variables=*/ cmNinjaVars());
} }
void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
{
WriteRule(*this->RulesFileStream,
"HELP",
"ninja -t targets",
"All primary targets available:",
"Rule for printing all primary targets available.",
/*depfile=*/ "",
/*restat=*/ false,
/*generator=*/ false);
WriteBuild(os,
"Print all primary targets available.",
"HELP",
/*outputs=*/ cmNinjaDeps(1, "help"),
/*explicitDeps=*/ cmNinjaDeps(),
/*implicitDeps=*/ cmNinjaDeps(),
/*orderOnlyDeps=*/ cmNinjaDeps(),
/*variables=*/ cmNinjaVars());
}

View File

@ -274,6 +274,7 @@ private:
void WriteTargetAll(std::ostream& os); void WriteTargetAll(std::ostream& os);
void WriteTargetRebuildManifest(std::ostream& os); void WriteTargetRebuildManifest(std::ostream& os);
void WriteTargetClean(std::ostream& os); void WriteTargetClean(std::ostream& os);
void WriteTargetHelp(std::ostream& os);
/// Called when we have seen the given custom command. Returns true /// Called when we have seen the given custom command. Returns true
/// if we has seen it before. /// if we has seen it before.