summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-08-01 20:16:21 (GMT)
committerBrad King <brad.king@kitware.com>2006-08-01 20:16:21 (GMT)
commitfe5a6e94137c4720871b4be268ada7a003efad5e (patch)
treee4733e74924ffd47129a017a0037216ed274483f /Source/cmLocalUnixMakefileGenerator3.cxx
parent2350085120bd0b50cf9c61c4b073126735426cb7 (diff)
downloadCMake-fe5a6e94137c4720871b4be268ada7a003efad5e.zip
CMake-fe5a6e94137c4720871b4be268ada7a003efad5e.tar.gz
CMake-fe5a6e94137c4720871b4be268ada7a003efad5e.tar.bz2
ENH: Moved generation of directory-level object convenience rules to a separate method. This will aid generation of more such rules later.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx57
1 files changed, 35 insertions, 22 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index fea2bd6..549ecaf 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -275,34 +275,15 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
gg->WriteConvenienceRules(ruleFileStream,emittedTargets);
}
- std::vector<std::string> depends;
- std::vector<std::string> commands;
-
// now write out the object rules
// for each object file name
for (std::map<cmStdString,std::vector<cmTarget *> >::iterator lo =
this->LocalObjectFiles.begin();
lo != this->LocalObjectFiles.end(); ++lo)
{
- commands.clear();
- // for each target using the object file
- for (std::vector<cmTarget *>::iterator to =
- lo->second.begin(); to != lo->second.end(); ++to)
- {
- std::string tgtMakefileName = this->GetRelativeTargetDirectory(**to);
- std::string targetName = tgtMakefileName;
- tgtMakefileName += "/build.make";
- targetName += "/";
- targetName += lo->first.c_str();
- commands.push_back(this->GetRecursiveMakeCall
- (tgtMakefileName.c_str(),targetName.c_str()));
- this->CreateCDCommand(commands,
- this->Makefile->GetHomeOutputDirectory(),
- this->Makefile->GetStartOutputDirectory());
- }
- this->WriteMakeRule(ruleFileStream,
- "target for object file",
- lo->first.c_str(), depends, commands, false);
+ this->WriteObjectConvenienceRule(ruleFileStream,
+ "target to build an object file",
+ lo->first.c_str(), lo->second);
}
// add a help target as long as there isn;t a real target named help
@@ -316,6 +297,38 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
this->WriteSpecialTargetsBottom(ruleFileStream);
}
+//----------------------------------------------------------------------------
+void
+cmLocalUnixMakefileGenerator3
+::WriteObjectConvenienceRule(std::ostream& ruleFileStream,
+ const char* output, const char* comment,
+ std::vector<cmTarget*>& targets)
+{
+ // Recursively make the rule for each target using the object file.
+ std::vector<std::string> commands;
+ for(std::vector<cmTarget*>::iterator t = targets.begin();
+ t != targets.end(); ++t)
+ {
+ std::string tgtMakefileName = this->GetRelativeTargetDirectory(**t);
+ std::string targetName = tgtMakefileName;
+ tgtMakefileName += "/build.make";
+ targetName += "/";
+ targetName += output;
+ commands.push_back(
+ this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName.c_str())
+ );
+ this->CreateCDCommand(commands,
+ this->Makefile->GetHomeOutputDirectory(),
+ this->Makefile->GetStartOutputDirectory());
+ }
+
+ // Write the rule to the makefile.
+ std::vector<std::string> no_depends;
+ this->WriteMakeRule(ruleFileStream, comment,
+ output, no_depends, commands, true);
+}
+
+//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3
::WriteLocalMakefileTargets(std::ostream& ruleFileStream,
std::set<cmStdString> &emitted)