diff options
author | Ken Martin <ken.martin@kitware.com> | 2005-05-11 16:44:01 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2005-05-11 16:44:01 (GMT) |
commit | 25d6c04add53631d6506674c3584fc0d8a6e0d46 (patch) | |
tree | a515ccaa50325b9258d09a41b108a6cbfc210d75 | |
parent | 25f75d90756fcd991554c3d5d0bb747ea4158dfd (diff) | |
download | CMake-25d6c04add53631d6506674c3584fc0d8a6e0d46.zip CMake-25d6c04add53631d6506674c3584fc0d8a6e0d46.tar.gz CMake-25d6c04add53631d6506674c3584fc0d8a6e0d46.tar.bz2 |
ENH: another snapshot
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 54 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 97 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.h | 5 |
3 files changed, 101 insertions, 55 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 14cf35f..ae278e3 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -156,6 +156,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile() this->WriteConvenienceRules(makefileStream,lg); } + lg = static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[0]); lg->WriteSpecialTargetsBottom(makefileStream); } @@ -352,11 +353,20 @@ void cmGlobalUnixMakefileGenerator3::WriteDependMakefile() { cmLocalUnixMakefileGenerator3 *lg2 = static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]); - if (!lg2->GetExcludeAll()) + // are any parents excluded + bool exclude = false; + cmLocalGenerator *lg3 = lg2; + while (lg3) { - lg2->WriteMainTargetIncludes(makefileStream,"depend.make","depend"); - lg2->WriteMainTargetRules(makefileStream,"depend.make","depend"); + if (lg3->GetExcludeAll()) + { + exclude = true; + break; + } + lg3 = lg3->GetParent(); } + lg2->WriteMainTargetIncludes(makefileStream,"depend.make","depend"); + lg2->WriteMainTargetRules(makefileStream,"depend.make","depend",!exclude); } } @@ -405,12 +415,9 @@ void cmGlobalUnixMakefileGenerator3::WriteBuildMakefile() } lg3 = lg3->GetParent(); } - if (!exclude) - { - lg2->WriteMainTargetIncludes(makefileStream,"build.make","build"); - lg2->WriteMainTargetRules(makefileStream,"build.make","build"); - lg2->WriteMainTargetRules(makefileStream,"build.make","requires"); - } + lg2->WriteMainTargetIncludes(makefileStream,"build.make","build"); + lg2->WriteMainTargetRules(makefileStream,"build.make","build",!exclude); + lg2->WriteMainTargetRules(makefileStream,"build.make","requires",!exclude); } } @@ -448,7 +455,7 @@ void cmGlobalUnixMakefileGenerator3::WriteCleanMakefile() cmLocalUnixMakefileGenerator3 *lg2 = static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]); lg2->WriteMainTargetIncludes(makefileStream,"clean.make","clean"); - lg2->WriteMainTargetRules(makefileStream,"clean.make","clean"); + lg2->WriteMainTargetRules(makefileStream,"clean.make","clean",true); // add the directory based rules lg2->WriteLocalCleanRule(makefileStream); } @@ -494,14 +501,33 @@ cmGlobalUnixMakefileGenerator3 std::vector<std::string> depends; std::vector<std::string> tgt_depends; std::vector<std::string> commands; + std::string localName; + std::string makeTargetName; depends.push_back("cmake_check_build_system"); + std::string dir = lg->GetMakefile()->GetStartOutputDirectory(); + dir = this->ConvertToHomeRelativeOutputPath(dir.c_str()); + localName = dir; + localName += "/directory"; + + // write the directory rule + commands.clear(); + makeTargetName = dir; + makeTargetName += "/depend"; + commands.push_back(lg->GetRecursiveMakeCall("depend.make",makeTargetName.c_str())); + makeTargetName = dir; + makeTargetName += "/requires"; + commands.push_back(lg->GetRecursiveMakeCall("depend.make",makeTargetName.c_str())); + makeTargetName = dir; + makeTargetName += "/build"; + commands.push_back(lg->GetRecursiveMakeCall("build.make",makeTargetName.c_str())); + + // Write the rule. + lg->WriteMakeRule(ruleFileStream, "Convenience name for target.", + localName.c_str(), depends, commands); - // for each target - // Generate the rule files for each target. + // for each target Generate the rule files for each target. const cmTargets& targets = lg->GetMakefile()->GetTargets(); - std::string localName; - std::string makeTargetName; for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t) { if((t->second.GetType() == cmTarget::EXECUTABLE) || diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 0604a8c..a6dcb76 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1105,34 +1105,69 @@ void cmLocalUnixMakefileGenerator3::WriteMainTargetIncludes(std::ostream& makefi void cmLocalUnixMakefileGenerator3::WriteMainTargetRules(std::ostream& makefileStream, const char *file, - const char *rule) + const char *rule, + bool inAll) { + std::vector<std::string> all_tgts; std::vector<std::string> depends; std::vector<std::string> no_commands; - for (cmTargets::const_iterator l = m_Makefile->GetTargets().begin(); - l != m_Makefile->GetTargets().end(); l++) + if (inAll) { - 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 && !strcmp(rule,"build"))) + for (cmTargets::const_iterator l = m_Makefile->GetTargets().begin(); + l != m_Makefile->GetTargets().end(); l++) { - // Add this to the list of depends rules in this directory. - if(l->second.IsInAll()) + 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 && !strcmp(rule,"build"))) { - // add the dependency + // Add this to the list of depends rules in this directory. std::string tname = this->GetRelativeTargetDirectory(l->second); tname += "/"; tname += rule; - depends.clear(); - depends.push_back(tname); - this->WriteMakeRule(makefileStream, 0, - rule, depends, no_commands); + all_tgts.push_back(tname); + if(l->second.IsInAll()) + { + // add the dependency + depends.clear(); + depends.push_back(tname); + this->WriteMakeRule(makefileStream, 0, + rule, depends, no_commands); + } } } } + + // not for the top gen + if (this->GetParent()) + { + // write the directory rule add in the subdirs + std::vector<cmLocalGenerator *> subdirs = this->GetChildren(); + std::string dir; + + // 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 += "/"; + dir += rule; + dir = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(dir.c_str()); + all_tgts.push_back(dir); + } + + dir = m_Makefile->GetStartOutputDirectory(); + dir += "/"; + dir += rule; + dir = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(dir.c_str()); + + this->WriteMakeRule(makefileStream, 0, + dir.c_str(), all_tgts, no_commands); + } } //---------------------------------------------------------------------------- @@ -2952,25 +2987,22 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() this->WriteMakeVariables(ruleFileStream); - std::vector<std::string> all_depends; std::vector<std::string> depends; std::vector<std::string> commands; // Write the empty all rule. + std::string dir = m_Makefile->GetStartOutputDirectory(); + dir += "/directory"; + dir = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(dir.c_str()); + this->CreateJumpCommand(commands,dir); this->WriteMakeRule(ruleFileStream, "The main all target", "all", depends, commands); // recursively write our targets - this->WriteLocalMakefileTargets(ruleFileStream, all_depends); - - // write out the all rule depends - commands.clear(); - this->WriteMakeRule(ruleFileStream, "The main all target", "all", all_depends, commands); - + this->WriteLocalMakefileTargets(ruleFileStream); } void cmLocalUnixMakefileGenerator3 -::WriteLocalMakefileTargets(std::ostream& ruleFileStream, - std::vector<std::string>& all_depends) +::WriteLocalMakefileTargets(std::ostream& ruleFileStream) { std::vector<std::string> depends; std::vector<std::string> commands; @@ -2990,7 +3022,6 @@ void cmLocalUnixMakefileGenerator3 localName = this->GetRelativeTargetDirectory(t->second); commands.clear(); depends.clear(); - all_depends.push_back(localName); this->CreateJumpCommand(commands,localName); this->WriteMakeRule(ruleFileStream, "Convenience name for target.", @@ -3006,18 +3037,6 @@ void cmLocalUnixMakefileGenerator3 } } } - - // for all children recurse - std::vector<cmLocalGenerator *> subdirs = this->GetChildren(); - - // for each subdir recurse - std::vector<cmLocalGenerator *>::iterator sdi = subdirs.begin(); - for (; sdi != subdirs.end(); ++sdi) - { - cmLocalUnixMakefileGenerator3 * lg = - static_cast<cmLocalUnixMakefileGenerator3 *>(*sdi); - lg->WriteLocalMakefileTargets(ruleFileStream,all_depends); - } } void cmLocalUnixMakefileGenerator3::CreateJumpCommand(std::vector<std::string>& commands, @@ -3136,7 +3155,9 @@ cmLocalUnixMakefileGenerator3 // Add the target. if (tgt && tgt[0] != '\0') { - cmd += tgt; + std::string tgt2 = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(tgt); + tgt2 = this->ConvertToMakeTarget(tgt2.c_str()); + cmd += tgt2; } return cmd; } diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 3e4f2f3..3b7ce12 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -130,7 +130,7 @@ public: void WriteMainTargetIncludes(std::ostream& makefileStream,const char *file, const char *rule); void WriteMainTargetRules(std::ostream& makefileStream,const char *file, - const char *rule); + const char *rule, bool inAll); void WriteSpecialTargetsBottom(std::ostream& makefileStream); @@ -148,8 +148,7 @@ public: protected: // write the target rules for the local Makefile into the stream - void WriteLocalMakefileTargets(std::ostream& ruleFileStream, - std::vector<std::string>& all_depends); + void WriteLocalMakefileTargets(std::ostream& ruleFileStream); // create the cd to home commands void CreateJumpCommand(std::vector<std::string>& commands, std::string & localName); |