From 61e056e2dc20af29d8a58e5fa9e7ea6c2b67c747 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 2 Jan 2006 12:36:54 -0500 Subject: BUG: fix for bug 2533, make foo/foo.o now works and .o files are in the help --- Source/cmGlobalUnixMakefileGenerator3.cxx | 8 ++++++++ Source/cmLocalUnixMakefileGenerator3.cxx | 20 +++++++++++++------- Source/cmLocalUnixMakefileGenerator3.h | 7 +++++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 38ab153..1f1c723 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -894,6 +894,14 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule } } } + std::map >& objs = lg->GetLocalObjectFiles(); + for(std::map >::iterator o = + objs.begin(); o != objs.end(); ++o) + { + path = "... "; + path += o->first; + lg->AppendEcho(commands, path.c_str()); + } } } lg->WriteMakeRule(ruleFileStream, "Help Target", diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e387465..7eb32d2 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/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 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; } diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 247efe8..5dfd86e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/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 > 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); -- cgit v0.12