فهرست منبع

ENH: Centralized generation of targets listed in the help to be done by the code that actually writes the targets.

Brad King 19 سال پیش
والد
کامیت
f826c6c58b
3فایلهای تغییر یافته به همراه20 افزوده شده و 11 حذف شده
  1. 6 8
      Source/cmGlobalUnixMakefileGenerator3.cxx
  2. 9 2
      Source/cmLocalUnixMakefileGenerator3.cxx
  3. 5 1
      Source/cmLocalUnixMakefileGenerator3.h

+ 6 - 8
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -1231,15 +1231,13 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
             }
           }
         }
-      typedef cmLocalUnixMakefileGenerator3::LocalObjectInfo LocalObjectInfo;
-      std::map<cmStdString, LocalObjectInfo> const& objs =
-        lg->GetLocalObjectFiles();
-      for(std::map<cmStdString, LocalObjectInfo>::const_iterator o =
-            objs.begin(); o != objs.end(); ++o)
+      std::vector<cmStdString> const& localHelp = lg->GetLocalHelp();
+      for(std::vector<cmStdString>::const_iterator o = localHelp.begin();
+          o != localHelp.end(); ++o)
         {
-         path = "... ";
-         path += o->first;
-         lg->AppendEcho(commands, path.c_str());
+        path = "... ";
+        path += *o;
+        lg->AppendEcho(commands, path.c_str());
         }
       }
     }

+ 9 - 2
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -369,7 +369,7 @@ cmLocalUnixMakefileGenerator3
   // Write the rule to the makefile.
   std::vector<std::string> no_depends;
   this->WriteMakeRule(ruleFileStream, comment,
-                      output, no_depends, commands, true);
+                      output, no_depends, commands, true, true);
 }
 
 //----------------------------------------------------------------------------
@@ -561,7 +561,8 @@ cmLocalUnixMakefileGenerator3
                 const char* target,
                 const std::vector<std::string>& depends,
                 const std::vector<std::string>& commands,
-                bool symbolic)
+                bool symbolic,
+                bool in_help)
 {
   // Make sure there is a target.
   if(!target || !*target)
@@ -637,6 +638,12 @@ cmLocalUnixMakefileGenerator3
     os << "\t" << replace.c_str() << "\n";
     }
   os << "\n";
+
+  // Add the output to the local help if requested.
+  if(in_help)
+    {
+    this->LocalHelp.push_back(target);
+    }
 }
 
 //----------------------------------------------------------------------------

+ 5 - 1
Source/cmLocalUnixMakefileGenerator3.h

@@ -73,7 +73,8 @@ public:
                      const char* target,
                      const std::vector<std::string>& depends,
                      const std::vector<std::string>& commands,
-                     bool symbolic);
+                     bool symbolic,
+                     bool in_help = false);
   
   // write the main variables used by the makefiles
   void WriteMakeVariables(std::ostream& makefileStream);
@@ -214,6 +215,8 @@ public:
   std::map<cmStdString, LocalObjectInfo> const& GetLocalObjectFiles()
     { return this->LocalObjectFiles;}
 
+  std::vector<cmStdString> const& GetLocalHelp() { return this->LocalHelp; }
+
   // return info about progress actions
   unsigned long GetNumberOfProgressActions();
   unsigned long GetNumberOfProgressActionsForTarget(const char *);
@@ -346,6 +349,7 @@ private:
   bool SkipAssemblySourceRules;
 
   std::map<cmStdString, LocalObjectInfo> LocalObjectFiles;
+  std::vector<cmStdString> LocalHelp;
 
   /* does the work for each target */
   std::vector<cmMakefileTargetGenerator *> TargetGenerators;