summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-06-25 13:58:51 (GMT)
committerBrad King <brad.king@kitware.com>2009-06-25 13:58:51 (GMT)
commitcd83f1979da5c2ed39e5824de70f2d84b8b1a4cc (patch)
tree4a19dcf2aa834fd8bfe4629dce874c17c4e05dca /Source/cmLocalUnixMakefileGenerator3.cxx
parentb9a98ef65b2c586d593219256a05a09c71216eee (diff)
downloadCMake-cd83f1979da5c2ed39e5824de70f2d84b8b1a4cc.zip
CMake-cd83f1979da5c2ed39e5824de70f2d84b8b1a4cc.tar.gz
CMake-cd83f1979da5c2ed39e5824de70f2d84b8b1a4cc.tar.bz2
ENH: Cleanup make progress rule generation code
This cleans up the Makefile generator's progress rule code. Instead of keeping every cmMakefileTargetGenerator instance alive to generate progress, we keep only the information necessary in a single table. This approach keeps most of the code in cmGlobalUnixMakefileGenerator3, thus simplifying its public interface.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx83
1 files changed, 9 insertions, 74 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index c37a80b..b5779bc 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -35,6 +35,8 @@
# include <cmsys/Terminal.h>
#endif
+#include <cmsys/auto_ptr.hxx>
+
#include <memory> // auto_ptr
#include <queue>
@@ -126,14 +128,16 @@ void cmLocalUnixMakefileGenerator3::Generate()
// Generate the rule files for each target.
cmTargets& targets = this->Makefile->GetTargets();
+ cmGlobalUnixMakefileGenerator3* gg =
+ static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
{
- cmMakefileTargetGenerator *tg =
- cmMakefileTargetGenerator::New(&(t->second));
- if (tg)
+ cmsys::auto_ptr<cmMakefileTargetGenerator> tg(
+ cmMakefileTargetGenerator::New(&(t->second)));
+ if (tg.get())
{
- this->TargetGenerators.push_back(tg);
tg->WriteRuleFiles();
+ gg->RecordTargetProgress(tg.get());
}
}
@@ -145,75 +149,6 @@ void cmLocalUnixMakefileGenerator3::Generate()
}
//----------------------------------------------------------------------------
-// return info about progress actions
-unsigned long cmLocalUnixMakefileGenerator3::GetNumberOfProgressActions()
-{
- unsigned long result = 0;
-
- for (std::vector<cmMakefileTargetGenerator *>::iterator mtgIter =
- this->TargetGenerators.begin();
- mtgIter != this->TargetGenerators.end(); ++mtgIter)
- {
- result += (*mtgIter)->GetNumberOfProgressActions();
- }
- return result;
-}
-
-//----------------------------------------------------------------------------
-// return info about progress actions
-unsigned long cmLocalUnixMakefileGenerator3
-::GetNumberOfProgressActionsForTarget(const char *name)
-{
- for (std::vector<cmMakefileTargetGenerator *>::iterator mtgIter =
- this->TargetGenerators.begin();
- mtgIter != this->TargetGenerators.end(); ++mtgIter)
- {
- if (!strcmp(name,(*mtgIter)->GetTarget()->GetName()))
- {
- return (*mtgIter)->GetNumberOfProgressActions();
- }
- }
- return 0;
-}
-
-
-//----------------------------------------------------------------------------
-// writes the progreess variables and also closes out the targets
-void cmLocalUnixMakefileGenerator3
-::WriteProgressVariables(unsigned long total,
- unsigned long &current)
-{
- // delete the makefile target generator objects
- for (std::vector<cmMakefileTargetGenerator *>::iterator mtgIter =
- this->TargetGenerators.begin();
- mtgIter != this->TargetGenerators.end(); ++mtgIter)
- {
- (*mtgIter)->WriteProgressVariables(total,current);
- delete *mtgIter;
- }
- this->TargetGenerators.clear();
-}
-
-void cmLocalUnixMakefileGenerator3::WriteAllProgressVariable()
-{
- // write the top level progress for the all target
- std::string progressFile = cmake::GetCMakeFilesDirectory();
- progressFile += "/progress.make";
- std::string progressFileNameFull =
- this->ConvertToFullPath(progressFile.c_str());
- cmGeneratedFileStream ruleFileStream(progressFileNameFull.c_str());
- if(!ruleFileStream)
- {
- return;
- }
-
- cmGlobalUnixMakefileGenerator3 *gg =
- static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
-
- ruleFileStream << gg->GetNumberOfProgressActionsInAll(this) << "\n";
-}
-
-//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
{
// generate the includes
@@ -1717,7 +1652,7 @@ void cmLocalUnixMakefileGenerator3
cmLocalGenerator::SHELL);
std::string progressFile = cmake::GetCMakeFilesDirectory();
- progressFile += "/progress.make";
+ progressFile += "/progress.marks";
std::string progressFileNameFull =
this->ConvertToFullPath(progressFile.c_str());
progCmd << " " << this->Convert(progressFileNameFull.c_str(),