diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-08-27 11:44:54 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-08-27 13:21:24 (GMT) |
commit | 51f7dcb0a55874e71e4695f5154548a41c87ad56 (patch) | |
tree | 5da054611f978cc5422e28f7252e130473cdc35b /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | ba4ba7c39de82b805652efbb7dc5e1659c53f36b (diff) | |
download | CMake-51f7dcb0a55874e71e4695f5154548a41c87ad56.zip CMake-51f7dcb0a55874e71e4695f5154548a41c87ad56.tar.gz CMake-51f7dcb0a55874e71e4695f5154548a41c87ad56.tar.bz2 |
Makefiles: Inline MakeLauncher into only caller
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 53c2ff6..53c9aa1 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -976,9 +976,33 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( // without the current directory being in the search path. cmd = "./" + cmd; } - std::string launcher = this->MakeLauncher( - ccg, target, workingDir.empty() ? cmOutputConverter::START_OUTPUT - : cmOutputConverter::NONE); + + 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], 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); if (shellCommand.empty()) { shellCommand = this->Convert(cmd, cmOutputConverter::NONE, @@ -1027,35 +1051,6 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( 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( std::vector<std::string>& commands, const std::vector<std::string>& files, cmGeneratorTarget* target, const char* filename) |