From c58a5198e5eb8878ad111be2eafcfef75e94b54b Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 9 Dec 2016 08:52:23 -0500 Subject: Makefile: Restore RULE_LAUNCH_COMPILE generation on compilation rules Refactoring in commit 425cd167 (cmLocalGenerator: Remove the launcher from RuleVariables, 2016-10-09) accidentally broke Makefile generator handling of `RULE_LAUNCH_COMPILE`. Responsibility moved from `ExpandRuleVariables` to its call sites, and the Makefile generator call site for compilations was not properly updated. Fix it now. --- Source/cmMakefileTargetGenerator.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index cbfe850..e3cde5e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -545,7 +545,6 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( } } cmRulePlaceholderExpander::RuleVariables vars; - vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; vars.CMTargetName = this->GeneratorTarget->GetName().c_str(); vars.CMTargetType = cmState::GetTargetTypeName(this->GeneratorTarget->GetType()); @@ -664,9 +663,20 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( } } + std::string launcher; + { + const char* val = this->LocalGenerator->GetRuleLauncher( + this->GeneratorTarget, "RULE_LAUNCH_COMPILE"); + if (val && *val) { + launcher = val; + launcher += " "; + } + } + // Expand placeholders in the commands. for (std::vector::iterator i = compileCommands.begin(); i != compileCommands.end(); ++i) { + *i = launcher + *i; rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i, vars); } -- cgit v0.12 From b7771078ad1ade95a4ae310815be7971017e10e1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 9 Dec 2016 08:54:10 -0500 Subject: Comment ExpandRuleVariables calls not preceded by launcher insertion Call sites of `ExpandRuleVariables` are now responsible for inserting the `RULE_LAUNCH_{COMPILE,LINK,CUSTOM}` values in rule command lines. Audit all call sites and add a comment to each one that does not insert a launcher to explain why. --- Source/cmMakefileTargetGenerator.cxx | 3 +++ Source/cmNinjaTargetGenerator.cxx | 1 + 2 files changed, 4 insertions(+) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e3cde5e..06bf2f5 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -606,6 +606,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( lang_can_export_cmds && compileCommands.size() == 1) { std::string compileCommand = compileCommands[0]; + // no launcher for CMAKE_EXPORT_COMPILE_COMMANDS rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, compileCommand, vars); std::string workingDirectory = cmSystemTools::CollapseFullPath( @@ -741,6 +742,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( // Expand placeholders in the commands. for (std::vector::iterator i = preprocessCommands.begin(); i != preprocessCommands.end(); ++i) { + // no launcher for preprocessor commands rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i, vars); } @@ -789,6 +791,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( // Expand placeholders in the commands. for (std::vector::iterator i = assemblyCommands.begin(); i != assemblyCommands.end(); ++i) { + // no launcher for assembly commands rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i, vars); } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1ac6cd4..489f120 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1015,6 +1015,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( for (std::vector::iterator i = compileCmds.begin(); i != compileCmds.end(); ++i) { + // no launcher for CMAKE_EXPORT_COMPILE_COMMANDS rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), *i, compileObjectVars); } -- cgit v0.12 From db61cd5d72f78aaf720f60f8e3a573fc36599bf9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 9 Dec 2016 08:57:26 -0500 Subject: cmRulePlaceholderExpander: Remove unused member RuleLauncher --- Source/cmRulePlaceholderExpander.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index 444419c..da59a6e 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -57,7 +57,6 @@ public: const char* LanguageCompileFlags; const char* Defines; const char* Includes; - const char* RuleLauncher; const char* DependencyFile; const char* FilterPrefix; }; -- cgit v0.12