Bladeren bron

BUG: fix for bug 2533, make foo/foo.o now works and .o files are in the help

Bill Hoffman 20 jaren geleden
bovenliggende
commit
61e056e2dc

+ 8 - 0
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -894,6 +894,14 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
             }
           }
         }
+      std::map<cmStdString,std::vector<cmTarget *> >& objs = lg->GetLocalObjectFiles();
+      for(std::map<cmStdString,std::vector<cmTarget *> >::iterator o =
+            objs.begin(); o != objs.end(); ++o)
+        {
+         path = "... ";
+         path += o->first;
+         lg->AppendEcho(commands, path.c_str());
+        }
       }
     }
   lg->WriteMakeRule(ruleFileStream, "Help Target",

+ 13 - 7
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -721,8 +721,8 @@ cmLocalUnixMakefileGenerator3
     }
 
   // Get the full path name of the object file.
-  std::string obj = this->GetObjectFileName(target, source);
-  
+  std::string objNoTargetDir;
+  std::string obj = this->GetObjectFileName(target, source, &objNoTargetDir);
   // Avoid generating duplicate rules.
   if(m_ObjectFiles.find(obj) == m_ObjectFiles.end())
     {
@@ -749,7 +749,6 @@ cmLocalUnixMakefileGenerator3
   objects.push_back(obj);
   std::string relativeObj = this->GetHomeRelativeOutputPath();
   relativeObj += obj;
-  
   // we compute some depends when writing the depend.make that we will also
   // use in the build.make, same with depMakeFile
   std::vector<std::string> depends;
@@ -761,9 +760,12 @@ cmLocalUnixMakefileGenerator3
   
   // The object file should be checked for dependency integrity.
   m_CheckDependFiles[target.GetName()][lang].insert(&source);
-     
   // add this to the list of objects for this local generator
-  m_LocalObjectFiles[cmSystemTools::GetFilenameName(obj)].push_back(&target);
+  if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str()))
+    {
+    objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
+    }
+  m_LocalObjectFiles[objNoTargetDir].push_back(&target);
 }
 
 //----------------------------------------------------------------------------
@@ -2124,7 +2126,8 @@ cmLocalUnixMakefileGenerator3
 std::string
 cmLocalUnixMakefileGenerator3
 ::GetObjectFileName(cmTarget& target,
-                    const cmSourceFile& source)
+                    const cmSourceFile& source,
+                    std::string* nameWithoutTargetDir)
 {
   // If the full path to the source file includes this directory,
   // we want to use the relative path for the filename of the
@@ -2152,11 +2155,14 @@ cmLocalUnixMakefileGenerator3
 
   // Convert to a safe name.
   objectName = this->CreateSafeUniqueObjectFileName(objectName.c_str());
-
   // Prepend the target directory.
   std::string obj = this->GetTargetDirectory(target);
   obj += "/";
   obj += objectName;
+  if(nameWithoutTargetDir)
+    {
+    *nameWithoutTargetDir = objectName;
+    }
   return obj;
 }
 

+ 5 - 2
Source/cmLocalUnixMakefileGenerator3.h

@@ -169,7 +169,9 @@ public:
 
   // write the target rules for the local Makefile into the stream
   void WriteLocalAllRules(std::ostream& ruleFileStream);
-
+  
+  std::map<cmStdString,std::vector<cmTarget *> > GetLocalObjectFiles()
+    { return m_LocalObjectFiles;}
 protected:
   // Return the a string with -F flags on apple
   std::string GetFrameworkFlags(cmTarget&);
@@ -320,7 +322,8 @@ protected:
   std::string GetTargetDirectory(cmTarget& target);
   std::string GetSubdirTargetName(const char* pass, const char* subdir);
   std::string GetObjectFileName(cmTarget& target,
-                                const cmSourceFile& source);
+                                const cmSourceFile& source,
+                                std::string* nameWithoutTargetDir = 0);
   const char* GetSourceFileLanguage(const cmSourceFile& source);
   std::string ConvertToQuotedOutputPath(const char* p);