From e92731ca6e4584c54b9603ebc812d3209e0d294e Mon Sep 17 00:00:00 2001
From: Ken Martin <ken.martin@kitware.com>
Date: Fri, 16 Jun 2006 15:29:25 -0400
Subject: ENH: cleanup how progress is reported for individual targets to fix
 an integer math issue

---
 Source/cmGlobalUnixMakefileGenerator3.cxx | 61 ++++++++++++-------------------
 1 file changed, 23 insertions(+), 38 deletions(-)

diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 9069095..764c346 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -710,48 +710,10 @@ cmGlobalUnixMakefileGenerator3
           
           // Write the rule.
           commands.clear();
-          std::string progressDir =
-            lg->GetMakefile()->GetHomeOutputDirectory();
-          progressDir += cmake::GetCMakeFilesDirectory();
-
-          {
-          // TODO: Convert the total progress count to a make variable.
-          cmOStringStream progCmd;
-          progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; 
-          // # in target
-          progCmd << lg->Convert(progressDir.c_str(),
-                                 cmLocalGenerator::FULL,
-                                 cmLocalGenerator::SHELL);
-          int n = this->GetNumberOfSourceFiles();
-          if(n > 100)
-            {
-            n = 100;
-            }
-          if (this->NumberOfSourceFiles)
-            {
-            progCmd << " " <<
-              (n*this->GetTargetTotalNumberOfSourceFiles(t->second))/
-              this->NumberOfSourceFiles;
-            }
-          else
-            {
-            progCmd << " 0";
-            }
-          commands.push_back(progCmd.str());
-          }
           std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
           tmp += "Makefile2";
           commands.push_back(lg->GetRecursiveMakeCall
                              (tmp.c_str(),t->second.GetName()));
-          {
-          cmOStringStream progCmd;
-          progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
-          progCmd << lg->Convert(progressDir.c_str(),
-                                 cmLocalGenerator::FULL,
-                                 cmLocalGenerator::SHELL);
-          progCmd << " 0";
-          commands.push_back(progCmd.str());
-          }
           depends.clear();
           depends.push_back("cmake_check_build_system");
           lg->WriteMakeRule(ruleFileStream, 
@@ -888,10 +850,33 @@ cmGlobalUnixMakefileGenerator3
         
         // Write the rule.
         commands.clear();
+        progressDir = lg->GetMakefile()->GetHomeOutputDirectory();
+        progressDir += cmake::GetCMakeFilesDirectory();
+        
+        {
+        // TODO: Convert the total progress count to a make variable.
+        cmOStringStream progCmd;
+        progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; 
+        // # in target
+        progCmd << lg->Convert(progressDir.c_str(),
+                               cmLocalGenerator::FULL,
+                               cmLocalGenerator::SHELL);
+        progCmd << " " << lg->ProgressFiles[t->first].size();
+        commands.push_back(progCmd.str());
+        }
         std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
         tmp += "Makefile2";
         commands.push_back(lg->GetRecursiveMakeCall
                            (tmp.c_str(),localName.c_str()));
+        {
+        cmOStringStream progCmd;
+        progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
+        progCmd << lg->Convert(progressDir.c_str(),
+                               cmLocalGenerator::FULL,
+                               cmLocalGenerator::SHELL);
+        progCmd << " 0";
+        commands.push_back(progCmd.str());
+        }
         depends.clear();
         depends.push_back("cmake_check_build_system");
         localName = lg->GetRelativeTargetDirectory(t->second);
-- 
cgit v0.12