ENH: optimization to not use requires step unless a language requires it
This commit is contained in:
parent
7157fa163c
commit
ef6c5ae23e
@ -532,6 +532,7 @@ cmGlobalUnixMakefileGenerator3
|
|||||||
|
|
||||||
// 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();
|
const cmTargets& targets = lg->GetMakefile()->GetTargets();
|
||||||
|
bool needRequiresStep = this->NeedRequiresStep(lg);
|
||||||
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
||||||
{
|
{
|
||||||
if((t->second.GetType() == cmTarget::EXECUTABLE) ||
|
if((t->second.GetType() == cmTarget::EXECUTABLE) ||
|
||||||
@ -552,11 +553,16 @@ cmGlobalUnixMakefileGenerator3
|
|||||||
makeTargetName += "/depend";
|
makeTargetName += "/depend";
|
||||||
commands.push_back(lg->GetRecursiveMakeCall(makefileName.c_str(),
|
commands.push_back(lg->GetRecursiveMakeCall(makefileName.c_str(),
|
||||||
makeTargetName.c_str()));
|
makeTargetName.c_str()));
|
||||||
|
|
||||||
|
// add requires if we need it for this generator
|
||||||
|
if (needRequiresStep)
|
||||||
|
{
|
||||||
makeTargetName = localName;
|
makeTargetName = localName;
|
||||||
makeTargetName += "/requires";
|
makeTargetName += "/requires";
|
||||||
commands.push_back(lg->GetRecursiveMakeCall(makefileName.c_str(),
|
commands.push_back(lg->GetRecursiveMakeCall(makefileName.c_str(),
|
||||||
makeTargetName.c_str()));
|
makeTargetName.c_str()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
makeTargetName = localName;
|
makeTargetName = localName;
|
||||||
makeTargetName += "/build";
|
makeTargetName += "/build";
|
||||||
commands.push_back(lg->GetRecursiveMakeCall(makefileName.c_str(),
|
commands.push_back(lg->GetRecursiveMakeCall(makefileName.c_str(),
|
||||||
@ -717,3 +723,24 @@ cmGlobalUnixMakefileGenerator3::WriteHelpRule(std::ostream& ruleFileStream)
|
|||||||
ruleFileStream << "\n\n";
|
ruleFileStream << "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool cmGlobalUnixMakefileGenerator3
|
||||||
|
::NeedRequiresStep(cmLocalUnixMakefileGenerator3 *lg)
|
||||||
|
{
|
||||||
|
std::map<cmStdString,cmLocalUnixMakefileGenerator3::IntegrityCheckSet>&
|
||||||
|
checkSet = lg->GetIntegrityCheckSet();
|
||||||
|
for(std::map<cmStdString,
|
||||||
|
cmLocalUnixMakefileGenerator3::IntegrityCheckSet>::const_iterator
|
||||||
|
l = checkSet.begin(); l != checkSet.end(); ++l)
|
||||||
|
{
|
||||||
|
std::string name = "CMAKE_NEEDS_REQUIRES_STEP_";
|
||||||
|
name += l->first;
|
||||||
|
name += "_FLAG";
|
||||||
|
if(lg->GetMakefile()->GetDefinition(name.c_str()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -75,6 +75,8 @@ protected:
|
|||||||
const cmTarget& target);
|
const cmTarget& target);
|
||||||
void AppendAnyGlobalDepend(std::vector<std::string>& depends, const char* name);
|
void AppendAnyGlobalDepend(std::vector<std::string>& depends, const char* name);
|
||||||
|
|
||||||
|
// does this generator need a requires step for any of its targets
|
||||||
|
bool NeedRequiresStep(cmLocalUnixMakefileGenerator3 *lg);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1082,20 +1082,6 @@ void cmLocalUnixMakefileGenerator3::WriteMainTargetIncludes(std::ostream& makefi
|
|||||||
std::vector<std::string> depends;
|
std::vector<std::string> depends;
|
||||||
std::vector<std::string> no_commands;
|
std::vector<std::string> no_commands;
|
||||||
|
|
||||||
// if this is the build rules also include the custom commands if there
|
|
||||||
// were any
|
|
||||||
if (!strcmp(rule,"build") && m_CustomRuleFiles.size())
|
|
||||||
{
|
|
||||||
// do the include
|
|
||||||
std::string dir = m_Makefile->GetStartOutputDirectory();
|
|
||||||
dir += "/CMakeCustomRules.dir/build.make";
|
|
||||||
dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
|
|
||||||
makefileStream
|
|
||||||
<< m_IncludeDirective << " "
|
|
||||||
<< this->ConvertToOutputForExisting(dir.c_str()).c_str()
|
|
||||||
<< "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this is the clean rules also include the custom commands if there
|
// if this is the clean rules also include the custom commands if there
|
||||||
// were any
|
// were any
|
||||||
const char* clean_no_custom = m_Makefile->GetProperty("CLEAN_NO_CUSTOM");
|
const char* clean_no_custom = m_Makefile->GetProperty("CLEAN_NO_CUSTOM");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user