From 5b95c0a881735cba6d6fcc661c6696d67f6badcd Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 21 Dec 2005 08:46:41 -0500 Subject: [PATCH] BUG: Libraries and executables that are built with version numbers and symlinks should be built by a rule using the real file name. The symlink file names should be rules that just depend on the main rule. This way if a version number changes a target will re-link with the new name and the symlinks will be updated. --- Source/cmLocalUnixMakefileGenerator3.cxx | 40 +++++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 3f59c9781..70627f31e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1464,7 +1464,19 @@ cmLocalUnixMakefileGenerator3 // Write the build rule. this->WriteMakeRule(ruleFileStream, 0, - targetFullPath.c_str(), depends, commands); + targetFullPathReal.c_str(), depends, commands); + + // The symlink name for the target should depend on the real target + // so if the target version changes it rebuilds and recreates the + // symlink. + if(targetFullPath != targetFullPathReal) + { + depends.clear(); + commands.clear(); + depends.push_back(targetFullPathReal.c_str()); + this->WriteMakeRule(ruleFileStream, 0, + targetFullPath.c_str(), depends, commands); + } // Write convenience targets. std::string dir = m_Makefile->GetStartOutputDirectory(); @@ -1794,11 +1806,29 @@ cmLocalUnixMakefileGenerator3 linkFlags.c_str()); } - // from here down is the same for exe or lib - // Write the build rule. - this->WriteMakeRule(ruleFileStream, 0, - targetFullPath.c_str(), depends, commands); + this->WriteMakeRule(ruleFileStream, 0, + targetFullPathReal.c_str(), depends, commands); + + // The symlink names for the target should depend on the real target + // so if the target version changes it rebuilds and recreates the + // symlinks. + if(targetFullPathSO != targetFullPathReal) + { + depends.clear(); + commands.clear(); + depends.push_back(targetFullPathReal.c_str()); + this->WriteMakeRule(ruleFileStream, 0, + targetFullPathSO.c_str(), depends, commands); + } + if(targetFullPath != targetFullPathSO) + { + depends.clear(); + commands.clear(); + depends.push_back(targetFullPathSO.c_str()); + this->WriteMakeRule(ruleFileStream, 0, + targetFullPath.c_str(), depends, commands); + } // Write convenience targets. std::string dir = m_Makefile->GetStartOutputDirectory();