Browse Source

ENH: some performance improvements

Ken Martin 20 years ago
parent
commit
1e78125a7b
2 changed files with 54 additions and 6 deletions
  1. 13 4
      Source/cmGlobalUnixMakefileGenerator3.cxx
  2. 41 2
      Source/cmLocalUnixMakefileGenerator3.cxx

+ 13 - 4
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -101,7 +101,11 @@ void cmGlobalUnixMakefileGenerator3::Generate()
   this->WriteMainCMakefile();
 
   // now write the support Makefiles
-  this->WriteBuildMakefile();
+
+  // we no longr use the build makefile, TODO remove this code and the code
+  // it makes use of later on 
+  // this->WriteBuildMakefile();
+
   this->WriteCleanMakefile();
 }
 
@@ -504,20 +508,25 @@ cmGlobalUnixMakefileGenerator3
       {
       // Add a rule to build the target by name.
       localName = lg->GetRelativeTargetDirectory(t->second);
+      std::string makefileName = localName;
+      makefileName += "/build.make";
       
       commands.clear();
       if (t->second.GetType() != cmTarget::UTILITY)
         {
         makeTargetName = localName;
         makeTargetName += "/depend";
-        commands.push_back(lg->GetRecursiveMakeCall("build.make",makeTargetName.c_str()));
+        commands.push_back(lg->GetRecursiveMakeCall(makefileName.c_str(),
+                                                    makeTargetName.c_str()));
         makeTargetName = localName;
         makeTargetName += "/requires";
-        commands.push_back(lg->GetRecursiveMakeCall("build.make",makeTargetName.c_str()));
+        commands.push_back(lg->GetRecursiveMakeCall(makefileName.c_str(),
+                                                    makeTargetName.c_str()));
         }
       makeTargetName = localName;
       makeTargetName += "/build";
-      commands.push_back(lg->GetRecursiveMakeCall("build.make",makeTargetName.c_str()));
+      commands.push_back(lg->GetRecursiveMakeCall(makefileName.c_str(),
+                                                  makeTargetName.c_str()));
 
       // Write the rule.
       localName += "/all";

+ 41 - 2
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -60,6 +60,11 @@ void cmLocalUnixMakefileGenerator3::Generate()
   // Setup our configuration variables for this directory.
   this->ConfigureOutputPaths();
 
+  // write the custom commands, this must happen before writing the targets,
+  // but... it may be that it needs to happen after the TraveVSDependencies
+  // call
+  this->WriteCustomCommands();
+
   // Generate the rule files for each target.
   cmTargets& targets = m_Makefile->GetTargets();
   std::string empty;
@@ -80,8 +85,6 @@ void cmLocalUnixMakefileGenerator3::Generate()
       }
     }
 
-  this->WriteCustomCommands();
-
   // write the local Makefile
   this->WriteLocalMakefile();
   
@@ -377,6 +380,21 @@ cmLocalUnixMakefileGenerator3
     }
   this->WriteDisclaimer(ruleFileStream);
 
+  this->WriteMakeVariables(ruleFileStream);
+  
+  // include the custom commands rules
+  if (m_CustomRuleFiles.size())
+    {
+    // do the include
+    std::string dir = m_Makefile->GetStartOutputDirectory();
+    dir += "/CMakeCustomRules.dir/build.make";
+    dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
+    ruleFileStream
+      << m_IncludeDirective << " "
+      << this->ConvertToOutputForExisting(dir.c_str()).c_str()
+      << "\n";
+    }
+
   // Include the rule file for each object.
   std::string relPath = this->GetHomeRelativeOutputPath();
   std::string objTarget;
@@ -821,9 +839,23 @@ cmLocalUnixMakefileGenerator3
     return;
     }
   this->WriteDisclaimer(ruleFileStream);
+  this->WriteMakeVariables(ruleFileStream);
   ruleFileStream
     << "# Utility rule file for " << target.GetName() << ".\n\n";
 
+  // include the custom commands rules
+  if (m_CustomRuleFiles.size())
+    {
+    // do the include
+    std::string dir = m_Makefile->GetStartOutputDirectory();
+    dir += "/CMakeCustomRules.dir/build.make";
+    dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
+    ruleFileStream
+      << m_IncludeDirective << " "
+      << this->ConvertToOutputForExisting(dir.c_str()).c_str()
+      << "\n";
+    }
+
   // Collect the commands and dependencies.
   std::vector<std::string> commands;
   std::vector<std::string> depends;
@@ -2300,6 +2332,12 @@ cmLocalUnixMakefileGenerator3
     }
 
   // Loop over all utility dependencies.
+
+  // Ken --- we trust that the parent build system handled the utility
+  // targets, really we trust that it also handled the libs but there is no
+  // harm in listing the libs as depends, if the libs are not present they
+  // cannot be built (the rules are not there) but at least it will squak
+#if 0
   const std::set<cmStdString>& tutils = target.GetUtilities();
   for(std::set<cmStdString>::const_iterator util = tutils.begin();
       util != tutils.end(); ++util)
@@ -2311,6 +2349,7 @@ cmLocalUnixMakefileGenerator3
       this->AppendAnyDepend(depends, util->c_str());
       }
     }
+#endif
 }
 
 //----------------------------------------------------------------------------