From 154a0cd16274832d8d4a64137478ebf65b95c684 Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Thu, 30 Jun 2005 09:53:03 -0400 Subject: ENH: added local help and install targets --- Source/cmLocalUnixMakefileGenerator3.cxx | 45 ++++++++++++++++++++++++++++++++ Source/cmLocalUnixMakefileGenerator3.h | 3 +++ 2 files changed, 48 insertions(+) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index aa79fed..04e64c9 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2780,6 +2780,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() this->WriteMakeVariables(ruleFileStream); + this->WriteSpecialTargetsTop(ruleFileStream); + std::vector depends; std::vector commands; @@ -2824,6 +2826,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() "target for object file", lo->first.c_str(), depends, commands); } + + this->WriteHelpRule(ruleFileStream); } void cmLocalUnixMakefileGenerator3 @@ -2999,3 +3003,44 @@ cmLocalUnixMakefileGenerator3 return cmd; } +//---------------------------------------------------------------------------- +void +cmLocalUnixMakefileGenerator3::WriteHelpRule(std::ostream& ruleFileStream) +{ + // add the help target + std::string path; + std::vector no_depends; + std::vector commands; + this->AppendEcho(commands, + "The following are some of the valid targets for this Makefile:"); + this->AppendEcho(commands,"... all (the default if no target is provided)"); + this->AppendEcho(commands,"... clean"); + this->AppendEcho(commands,"... install"); + this->AppendEcho(commands,"... rebuild_cache"); + + // Keep track of targets already listed. + std::set emittedTargets; + + // for each target Generate the rule files for each target. + cmTargets& targets = this->GetMakefile()->GetTargets(); + for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) + { + if((t->second.GetType() == cmTarget::EXECUTABLE) || + (t->second.GetType() == cmTarget::STATIC_LIBRARY) || + (t->second.GetType() == cmTarget::SHARED_LIBRARY) || + (t->second.GetType() == cmTarget::MODULE_LIBRARY) || + (t->second.GetType() == cmTarget::UTILITY)) + { + if(emittedTargets.insert(t->second.GetName()).second) + { + path = "... "; + path += t->second.GetName(); + this->AppendEcho(commands,path.c_str()); + } + } + } + this->WriteMakeRule(ruleFileStream, "Help Target", + "help:", + no_depends, commands); + ruleFileStream << "\n\n"; +} diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 826b053..8ba857d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -157,6 +157,9 @@ protected: // write the target rules for the local Makefile into the stream void WriteLocalMakefileTargets(std::ostream& ruleFileStream); + + // write the local help rule + void WriteHelpRule(std::ostream& ruleFileStream); // create the cd to home commands void CreateJumpCommand(std::vector& commands, -- cgit v0.12