summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx28
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx32
-rw-r--r--Source/cmMakefileTargetGenerator.cxx38
-rw-r--r--Source/cmMakefileTargetGenerator.h5
4 files changed, 48 insertions, 55 deletions
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index c741284..848ae20 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -353,33 +353,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Construct object file lists that may be needed to expand the
// rule.
- std::string variableName;
- std::string variableNameExternal;
- this->WriteObjectsVariable(variableName, variableNameExternal);
std::string buildObjs;
- if(useResponseFile)
- {
- std::string objects;
- this->WriteObjectsString(objects);
- std::string objects_rsp =
- this->CreateResponseFile("objects.rsp", objects, depends);
- buildObjs = "@";
- buildObjs += this->Convert(objects_rsp.c_str(),
- cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL);
- }
- else if(useLinkScript)
- {
- this->WriteObjectsString(buildObjs);
- }
- else
- {
- buildObjs = "$(";
- buildObjs += variableName;
- buildObjs += ") $(";
- buildObjs += variableNameExternal;
- buildObjs += ")";
- }
+ this->CreateObjectLists(useLinkScript, false, useResponseFile,
+ buildObjs, depends);
cmLocalGenerator::RuleVariables vars;
vars.Language = linkLanguage;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 9cde469..a67b44a 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -687,36 +687,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Construct object file lists that may be needed to expand the
// rule.
- std::string variableName;
- std::string variableNameExternal;
- this->WriteObjectsVariable(variableName, variableNameExternal);
std::string buildObjs;
- if(useResponseFile)
- {
- std::string objects;
- this->WriteObjectsString(objects);
- std::string objects_rsp =
- this->CreateResponseFile("objects.rsp", objects, depends);
- buildObjs = "@";
- buildObjs += this->Convert(objects_rsp.c_str(),
- cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL);
- }
- else if(useLinkScript)
- {
- if(!useArchiveRules)
- {
- this->WriteObjectsString(buildObjs);
- }
- }
- else
- {
- buildObjs = "$(";
- buildObjs += variableName;
- buildObjs += ") $(";
- buildObjs += variableNameExternal;
- buildObjs += ")";
- }
+ this->CreateObjectLists(useLinkScript, useArchiveRules, useResponseFile,
+ buildObjs, depends);
+
cmLocalGenerator::RuleVariables vars;
vars.TargetPDB = targetOutPathPDB.c_str();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 0374373..b25ae60 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1623,6 +1623,44 @@ cmMakefileTargetGenerator
}
//----------------------------------------------------------------------------
+void
+cmMakefileTargetGenerator
+::CreateObjectLists(bool useLinkScript, bool useArchiveRules,
+ bool useResponseFile, std::string& buildObjs,
+ std::vector<std::string>& makefile_depends)
+{
+ std::string variableName;
+ std::string variableNameExternal;
+ this->WriteObjectsVariable(variableName, variableNameExternal);
+ if(useResponseFile)
+ {
+ std::string objects;
+ this->WriteObjectsString(objects);
+ std::string objects_rsp =
+ this->CreateResponseFile("objects.rsp", objects, makefile_depends);
+ buildObjs = "@";
+ buildObjs += this->Convert(objects_rsp.c_str(),
+ cmLocalGenerator::NONE,
+ cmLocalGenerator::SHELL);
+ }
+ else if(useLinkScript)
+ {
+ if(!useArchiveRules)
+ {
+ this->WriteObjectsString(buildObjs);
+ }
+ }
+ else
+ {
+ buildObjs = "$(";
+ buildObjs += variableName;
+ buildObjs += ") $(";
+ buildObjs += variableNameExternal;
+ buildObjs += ")";
+ }
+}
+
+//----------------------------------------------------------------------------
const char* cmMakefileTargetGenerator::GetFortranModuleDirectory()
{
// Compute the module directory.
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 0b55c6e..c7cbab9 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -144,6 +144,11 @@ protected:
std::string const& options,
std::vector<std::string>& makefile_depends);
+ /** Create lists of object files for linking and cleaning. */
+ void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
+ bool useResponseFile, std::string& buildObjs,
+ std::vector<std::string>& makefile_depends);
+
virtual void CloseFileStreams();
void RemoveForbiddenFlags(const char* flagVar, const char* linkLang,
std::string& linkFlags);