STYLE: add some better comments and remove some unused code
This commit is contained in:
parent
d101f94f9b
commit
f79376c1d1
|
@ -99,9 +99,6 @@ void cmGlobalUnixMakefileGenerator3::Generate()
|
|||
// write the main makefile
|
||||
this->WriteMainMakefile();
|
||||
this->WriteMainCMakefile();
|
||||
|
||||
// now write the support Makefiles
|
||||
//this->WriteBuildMakefile();
|
||||
}
|
||||
|
||||
void cmGlobalUnixMakefileGenerator3::WriteMainMakefile()
|
||||
|
@ -327,61 +324,6 @@ void cmGlobalUnixMakefileGenerator3
|
|||
}
|
||||
}
|
||||
|
||||
void cmGlobalUnixMakefileGenerator3::WriteBuildMakefile()
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
// Open the output file. This should not be copy-if-different
|
||||
// because the check-build-system step compares the makefile time to
|
||||
// see if the build system must be regenerated.
|
||||
std::string makefileName = this->GetCMakeInstance()->GetHomeOutputDirectory();
|
||||
makefileName += "/build.make";
|
||||
cmGeneratedFileStream makefileStream(makefileName.c_str());
|
||||
if(!makefileStream)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// get a local generator for some useful methods
|
||||
cmLocalUnixMakefileGenerator3 *lg =
|
||||
static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[0]);
|
||||
|
||||
// Write the do not edit header.
|
||||
lg->WriteDisclaimer(makefileStream);
|
||||
lg->WriteMakeVariables(makefileStream);
|
||||
|
||||
// add the generic dependency
|
||||
std::vector<std::string> depends;
|
||||
std::vector<std::string> no_commands;
|
||||
lg->WriteMakeRule(makefileStream, 0, "build", depends, no_commands);
|
||||
lg->WriteMakeRule(makefileStream, 0, "depend", depends, no_commands);
|
||||
lg->WriteMakeRule(makefileStream, 0, "requires", depends, no_commands);
|
||||
|
||||
// include all the target depends
|
||||
for (i = 0; i < m_LocalGenerators.size(); ++i)
|
||||
{
|
||||
cmLocalUnixMakefileGenerator3 *lg2 =
|
||||
static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]);
|
||||
// are any parents excluded
|
||||
bool exclude = false;
|
||||
cmLocalGenerator *lg3 = lg2;
|
||||
while (lg3)
|
||||
{
|
||||
if (lg3->GetExcludeAll())
|
||||
{
|
||||
exclude = true;
|
||||
break;
|
||||
}
|
||||
lg3 = lg3->GetParent();
|
||||
}
|
||||
lg2->WriteMainTargetIncludes(makefileStream,"build.make","build");
|
||||
lg2->WriteMainTargetRules(makefileStream,"build.make","depend",!exclude);
|
||||
lg2->WriteMainTargetRules(makefileStream,"build.make","requires",!exclude);
|
||||
lg2->WriteMainTargetRules(makefileStream,"build.make","build",!exclude);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalUnixMakefileGenerator3
|
||||
::WriteAllRules(cmLocalUnixMakefileGenerator3 *lg,
|
||||
|
@ -418,20 +360,25 @@ void cmGlobalUnixMakefileGenerator3
|
|||
//----------------------------------------------------------------------------
|
||||
void
|
||||
cmGlobalUnixMakefileGenerator3
|
||||
::WriteConvenienceRules(std::ostream& ruleFileStream,
|
||||
cmLocalUnixMakefileGenerator3 *lg,
|
||||
bool exclude)
|
||||
::WriteDirectoryRules(std::ostream& ruleFileStream,
|
||||
cmLocalUnixMakefileGenerator3 *lg)
|
||||
{
|
||||
std::vector<std::string> depends;
|
||||
std::vector<std::string> commands;
|
||||
std::string localName;
|
||||
std::string makeTargetName;
|
||||
|
||||
|
||||
depends.push_back("cmake_check_build_system");
|
||||
if (lg->GetParent())
|
||||
{
|
||||
std::string dir = lg->GetMakefile()->GetStartOutputDirectory();
|
||||
dir = lg->Convert(dir.c_str(),cmLocalGenerator::HOME_OUTPUT,cmLocalGenerator::MAKEFILE);
|
||||
|
||||
lg->WriteDivider(ruleFileStream);
|
||||
ruleFileStream
|
||||
<< "# Directory level rules for directory "
|
||||
<< dir << "\n\n";
|
||||
|
||||
localName = dir;
|
||||
localName += "/directorystart";
|
||||
makeTargetName = dir;
|
||||
|
@ -538,6 +485,24 @@ cmGlobalUnixMakefileGenerator3
|
|||
lg->WriteMakeRule(ruleFileStream, "Convenience name for directory clean.",
|
||||
makeTargetName.c_str(), all_tgts, commands);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
cmGlobalUnixMakefileGenerator3
|
||||
::WriteConvenienceRules(std::ostream& ruleFileStream,
|
||||
cmLocalUnixMakefileGenerator3 *lg,
|
||||
bool exclude)
|
||||
{
|
||||
std::vector<std::string> depends;
|
||||
std::vector<std::string> commands;
|
||||
std::string localName;
|
||||
std::string makeTargetName;
|
||||
|
||||
// write the directory level rules for this local gen
|
||||
this->WriteDirectoryRules(ruleFileStream,lg);
|
||||
|
||||
depends.push_back("cmake_check_build_system");
|
||||
|
||||
// for each target Generate the rule files for each target.
|
||||
const cmTargets& targets = lg->GetMakefile()->GetTargets();
|
||||
|
@ -555,6 +520,11 @@ cmGlobalUnixMakefileGenerator3
|
|||
std::string makefileName = localName;
|
||||
makefileName += "/build.make";
|
||||
|
||||
lg->WriteDivider(ruleFileStream);
|
||||
ruleFileStream
|
||||
<< "# Target rules for target "
|
||||
<< localName << "\n\n";
|
||||
|
||||
commands.clear();
|
||||
if (t->second.GetType() != cmTarget::UTILITY)
|
||||
{
|
||||
|
|
|
@ -60,7 +60,6 @@ public:
|
|||
protected:
|
||||
void WriteMainMakefile();
|
||||
void WriteMainCMakefile();
|
||||
void WriteBuildMakefile();
|
||||
void WriteMainCMakefileLanguageRules(cmGeneratedFileStream& cmakefileStream);
|
||||
void WriteAllRules(cmLocalUnixMakefileGenerator3 *lg,
|
||||
std::ostream& makefileStream);
|
||||
|
@ -69,6 +68,8 @@ protected:
|
|||
void WriteConvenienceRules(std::ostream& ruleFileStream,
|
||||
cmLocalUnixMakefileGenerator3 *,
|
||||
bool exclude);
|
||||
void WriteDirectoryRules(std::ostream& ruleFileStream,
|
||||
cmLocalUnixMakefileGenerator3 *lg);
|
||||
|
||||
void AppendGlobalTargetDepends(std::vector<std::string>& depends,
|
||||
const cmTarget& target);
|
||||
|
|
|
@ -988,101 +988,6 @@ cmLocalUnixMakefileGenerator3
|
|||
<< "\n";
|
||||
}
|
||||
|
||||
void cmLocalUnixMakefileGenerator3::WriteMainTargetIncludes(std::ostream& makefileStream,
|
||||
const char *file,
|
||||
const char *rule)
|
||||
{
|
||||
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((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")))
|
||||
{
|
||||
// do the include
|
||||
std::string tname = this->GetRelativeTargetDirectory(l->second);
|
||||
tname += "/";
|
||||
tname += file;
|
||||
makefileStream
|
||||
<< m_IncludeDirective << " "
|
||||
<< this->ConvertToOutputForExisting(tname.c_str()).c_str()
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cmLocalUnixMakefileGenerator3::WriteMainTargetRules(std::ostream& makefileStream,
|
||||
const char * /* file */,
|
||||
const char *rule,
|
||||
bool inAll)
|
||||
{
|
||||
std::vector<std::string> all_tgts;
|
||||
std::vector<std::string> depends;
|
||||
std::vector<std::string> no_commands;
|
||||
|
||||
if (inAll)
|
||||
{
|
||||
for (cmTargets::const_iterator l = m_Makefile->GetTargets().begin();
|
||||
l != m_Makefile->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 && !strcmp(rule,"build")))
|
||||
{
|
||||
// Add this to the list of depends rules in this directory.
|
||||
std::string tname = this->GetRelativeTargetDirectory(l->second);
|
||||
tname += "/";
|
||||
tname += rule;
|
||||
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 = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
|
||||
all_tgts.push_back(dir);
|
||||
}
|
||||
|
||||
dir = m_Makefile->GetStartOutputDirectory();
|
||||
dir += "/";
|
||||
dir += rule;
|
||||
dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
|
||||
|
||||
this->WriteMakeRule(makefileStream, 0,
|
||||
dir.c_str(), all_tgts, no_commands);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
cmLocalUnixMakefileGenerator3
|
||||
|
|
|
@ -127,12 +127,6 @@ public:
|
|||
/** write some extra rules suahc as make test etc */
|
||||
void WriteSpecialTargetsTop(std::ostream& makefileStream);
|
||||
|
||||
void WriteMainTargetIncludes(std::ostream& makefileStream,const char *file,
|
||||
const char *rule);
|
||||
void WriteMainTargetRules(std::ostream& makefileStream,const char *file,
|
||||
const char *rule, bool inAll);
|
||||
|
||||
|
||||
void WriteSpecialTargetsBottom(std::ostream& makefileStream);
|
||||
std::string GetRelativeTargetDirectory(const cmTarget& target);
|
||||
|
||||
|
|
Loading…
Reference in New Issue