Makefiles: Inline MakeLauncher into only caller

This commit is contained in:
Stephen Kelly 2016-08-27 13:44:54 +02:00
parent ba4ba7c39d
commit 51f7dcb0a5
2 changed files with 27 additions and 35 deletions

View File

@ -976,9 +976,33 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// without the current directory being in the search path. // without the current directory being in the search path.
cmd = "./" + cmd; cmd = "./" + cmd;
} }
std::string launcher = this->MakeLauncher(
ccg, target, workingDir.empty() ? cmOutputConverter::START_OUTPUT std::string launcher;
: cmOutputConverter::NONE); // Short-circuit if there is no launcher.
const char* prop = "RULE_LAUNCH_CUSTOM";
const char* val = this->GetRuleLauncher(target, prop);
if (val && *val) {
// Expand rules in the empty string. It may insert the launcher and
// perform replacements.
RuleVariables vars;
vars.RuleLauncher = prop;
vars.CMTarget = target;
std::string output;
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
output = this->Convert(outputs[0], workingDir.empty()
? cmOutputConverter::START_OUTPUT
: cmOutputConverter::NONE,
cmOutputConverter::SHELL);
}
vars.Output = output.c_str();
this->ExpandRuleVariables(launcher, vars);
if (!launcher.empty()) {
launcher += " ";
}
}
std::string shellCommand = this->MaybeConvertWatcomShellCommand(cmd); std::string shellCommand = this->MaybeConvertWatcomShellCommand(cmd);
if (shellCommand.empty()) { if (shellCommand.empty()) {
shellCommand = this->Convert(cmd, cmOutputConverter::NONE, shellCommand = this->Convert(cmd, cmOutputConverter::NONE,
@ -1027,35 +1051,6 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
commands.insert(commands.end(), commands1.begin(), commands1.end()); commands.insert(commands.end(), commands1.begin(), commands1.end());
} }
std::string cmLocalUnixMakefileGenerator3::MakeLauncher(
cmCustomCommandGenerator const& ccg, cmGeneratorTarget* target,
cmOutputConverter::RelativeRoot relative)
{
std::string launcher;
// Short-circuit if there is no launcher.
const char* prop = "RULE_LAUNCH_CUSTOM";
const char* val = this->GetRuleLauncher(target, prop);
if (val && *val) {
// Expand rules in the empty string. It may insert the launcher and
// perform replacements.
RuleVariables vars;
vars.RuleLauncher = prop;
vars.CMTarget = target;
std::string output;
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
output = this->Convert(outputs[0], relative, cmOutputConverter::SHELL);
}
vars.Output = output.c_str();
this->ExpandRuleVariables(launcher, vars);
if (!launcher.empty()) {
launcher += " ";
}
}
return launcher;
}
void cmLocalUnixMakefileGenerator3::AppendCleanCommand( void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
std::vector<std::string>& commands, const std::vector<std::string>& files, std::vector<std::string>& commands, const std::vector<std::string>& files,
cmGeneratorTarget* target, const char* filename) cmGeneratorTarget* target, const char* filename)

View File

@ -251,9 +251,6 @@ protected:
private: private:
std::string MaybeConvertWatcomShellCommand(std::string const& cmd); std::string MaybeConvertWatcomShellCommand(std::string const& cmd);
std::string MakeLauncher(cmCustomCommandGenerator const& ccg,
cmGeneratorTarget* target,
cmOutputConverter::RelativeRoot relative);
void ComputeObjectFilenames( void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping, std::map<cmSourceFile const*, std::string>& mapping,