ENH: fixes for subdir build Makefiles
This commit is contained in:
parent
6adbe6d049
commit
463c8e07a8
|
@ -477,23 +477,60 @@ cmGlobalUnixMakefileGenerator3
|
||||||
std::string dir = lg->GetMakefile()->GetStartOutputDirectory();
|
std::string dir = lg->GetMakefile()->GetStartOutputDirectory();
|
||||||
dir = lg->Convert(dir.c_str(),cmLocalGenerator::HOME_OUTPUT,cmLocalGenerator::MAKEFILE);
|
dir = lg->Convert(dir.c_str(),cmLocalGenerator::HOME_OUTPUT,cmLocalGenerator::MAKEFILE);
|
||||||
localName = dir;
|
localName = dir;
|
||||||
localName += "/directory";
|
localName += "/directorystart";
|
||||||
|
makeTargetName = dir;
|
||||||
|
makeTargetName += "/directory";
|
||||||
|
|
||||||
|
std::vector<std::string> all_tgts;
|
||||||
|
|
||||||
|
// for all of out targets
|
||||||
|
for (cmTargets::const_iterator l = lg->GetMakefile()->GetTargets().begin();
|
||||||
|
l != lg->GetMakefile()->GetTargets().end(); l++)
|
||||||
|
{
|
||||||
|
if((l->second.GetType() == cmTarget::EXECUTABLE) ||
|
||||||
|
(l->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
||||||
|
(l->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
|
(l->second.GetType() == cmTarget::MODULE_LIBRARY) ||
|
||||||
|
(l->second.GetType() == cmTarget::UTILITY))
|
||||||
|
{
|
||||||
|
// Add this to the list of depends rules in this directory.
|
||||||
|
if(l->second.IsInAll())
|
||||||
|
{
|
||||||
|
std::string tname = lg->GetRelativeTargetDirectory(l->second);
|
||||||
|
tname += "/all";
|
||||||
|
all_tgts.push_back(tname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// write the directory rule add in the subdirs
|
||||||
|
std::vector<cmLocalGenerator *> subdirs = lg->GetChildren();
|
||||||
|
|
||||||
|
// for each subdir add the directory depend
|
||||||
|
std::vector<cmLocalGenerator *>::iterator sdi = subdirs.begin();
|
||||||
|
for (; sdi != subdirs.end(); ++sdi)
|
||||||
|
{
|
||||||
|
cmLocalUnixMakefileGenerator3 * lg =
|
||||||
|
static_cast<cmLocalUnixMakefileGenerator3 *>(*sdi);
|
||||||
|
dir = lg->GetMakefile()->GetStartOutputDirectory();
|
||||||
|
dir += "/directory";
|
||||||
|
dir = lg->Convert(dir.c_str(),cmLocalGenerator::HOME_OUTPUT,
|
||||||
|
cmLocalGenerator::MAKEFILE);
|
||||||
|
all_tgts.push_back(dir);
|
||||||
|
}
|
||||||
|
|
||||||
// write the directory rule
|
// write the directory rule
|
||||||
commands.clear();
|
commands.clear();
|
||||||
makeTargetName = dir;
|
commands.push_back(lg->GetRecursiveMakeCall("Makefile",makeTargetName.c_str()));
|
||||||
makeTargetName += "/depend";
|
|
||||||
commands.push_back(lg->GetRecursiveMakeCall("build.make",makeTargetName.c_str()));
|
|
||||||
makeTargetName = dir;
|
|
||||||
makeTargetName += "/requires";
|
|
||||||
commands.push_back(lg->GetRecursiveMakeCall("build.make",makeTargetName.c_str()));
|
|
||||||
makeTargetName = dir;
|
|
||||||
makeTargetName += "/build";
|
|
||||||
commands.push_back(lg->GetRecursiveMakeCall("build.make",makeTargetName.c_str()));
|
|
||||||
|
|
||||||
// Write the rule.
|
// Write the rule.
|
||||||
lg->WriteMakeRule(ruleFileStream, "Convenience name for directory.",
|
lg->WriteMakeRule(ruleFileStream, "Convenience name for directory.",
|
||||||
localName.c_str(), depends, commands);
|
localName.c_str(), depends, commands);
|
||||||
|
|
||||||
|
// Write the rule.
|
||||||
|
commands.clear();
|
||||||
|
lg->WriteMakeRule(ruleFileStream, "Convenience name for directory.",
|
||||||
|
makeTargetName.c_str(), all_tgts, commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for each target Generate the rule files for each target.
|
// for each target Generate the rule files for each target.
|
||||||
|
|
|
@ -2916,7 +2916,7 @@ cmLocalUnixMakefileGenerator3
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
|
void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
|
||||||
{
|
{
|
||||||
// only write the locla Makefile if we are not at the top
|
// only write the local Makefile if we are not at the top
|
||||||
if (!m_Parent)
|
if (!m_Parent)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -2943,7 +2943,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
|
||||||
|
|
||||||
// Write the empty all rule.
|
// Write the empty all rule.
|
||||||
std::string dir = m_Makefile->GetStartOutputDirectory();
|
std::string dir = m_Makefile->GetStartOutputDirectory();
|
||||||
dir += "/directory";
|
dir += "/directorystart";
|
||||||
dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
|
dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
|
||||||
this->CreateJumpCommand(commands,dir);
|
this->CreateJumpCommand(commands,dir);
|
||||||
this->WriteMakeRule(ruleFileStream, "The main all target", "all", depends, commands);
|
this->WriteMakeRule(ruleFileStream, "The main all target", "all", depends, commands);
|
||||||
|
|
Loading…
Reference in New Issue