BUG: A utility target should not run the custom commands from its source files directly. The target-level rule must add dependencies on the file-level custom commands to drive them. This bug was introduced by the "fix" to bug 4377. This also restores the documented behavior that PRE_BUILD rules are treated as PRE_LINK rules on non-VS generators. Also fixed custom command dependencies on the rule file build.make so that custom commands re-run when the commands themselves change.
This commit is contained in:
parent
ef0b9ff2cc
commit
c51c245efa
|
@ -27,7 +27,7 @@
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator()
|
cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator()
|
||||||
{
|
{
|
||||||
this->DriveCustomCommandsOnDepends = true;
|
this->CustomCommandDriver = OnDepends;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator()
|
cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator()
|
||||||
{
|
{
|
||||||
this->DriveCustomCommandsOnDepends = true;
|
this->CustomCommandDriver = OnDepends;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -35,7 +35,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator()
|
||||||
this->BuildFileStream = 0;
|
this->BuildFileStream = 0;
|
||||||
this->InfoFileStream = 0;
|
this->InfoFileStream = 0;
|
||||||
this->FlagFileStream = 0;
|
this->FlagFileStream = 0;
|
||||||
this->DriveCustomCommandsOnDepends = false;
|
this->CustomCommandDriver = OnBuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmMakefileTargetGenerator *
|
cmMakefileTargetGenerator *
|
||||||
|
@ -788,7 +788,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
|
||||||
commands.push_back(depCmd.str());
|
commands.push_back(depCmd.str());
|
||||||
|
|
||||||
// Make sure all custom command outputs in this target are built.
|
// Make sure all custom command outputs in this target are built.
|
||||||
if(this->DriveCustomCommandsOnDepends)
|
if(this->CustomCommandDriver == OnDepends)
|
||||||
{
|
{
|
||||||
this->DriveCustomCommands(depends);
|
this->DriveCustomCommands(depends);
|
||||||
}
|
}
|
||||||
|
@ -874,6 +874,10 @@ void cmMakefileTargetGenerator
|
||||||
std::vector<std::string> depends;
|
std::vector<std::string> depends;
|
||||||
this->LocalGenerator->AppendCustomDepend(depends, cc);
|
this->LocalGenerator->AppendCustomDepend(depends, cc);
|
||||||
|
|
||||||
|
// Add a dependency on the rule file itself.
|
||||||
|
this->LocalGenerator->AppendRuleDepend(depends,
|
||||||
|
this->BuildFileNameFull.c_str());
|
||||||
|
|
||||||
// Check whether we need to bother checking for a symbolic output.
|
// Check whether we need to bother checking for a symbolic output.
|
||||||
bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark();
|
bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark();
|
||||||
|
|
||||||
|
@ -1096,7 +1100,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
|
||||||
comment = "Rule to build all files generated by this target.";
|
comment = "Rule to build all files generated by this target.";
|
||||||
|
|
||||||
// Make sure all custom command outputs in this target are built.
|
// Make sure all custom command outputs in this target are built.
|
||||||
if(!this->DriveCustomCommandsOnDepends)
|
if(this->CustomCommandDriver == OnBuild)
|
||||||
{
|
{
|
||||||
this->DriveCustomCommands(depends);
|
this->DriveCustomCommands(depends);
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,8 @@ protected:
|
||||||
cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
|
cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
|
||||||
cmMakefile *Makefile;
|
cmMakefile *Makefile;
|
||||||
|
|
||||||
bool DriveCustomCommandsOnDepends;
|
enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility };
|
||||||
|
CustomCommandDriveType CustomCommandDriver;
|
||||||
|
|
||||||
// the full path to the build file
|
// the full path to the build file
|
||||||
std::string BuildFileName;
|
std::string BuildFileName;
|
||||||
|
|
|
@ -26,10 +26,9 @@
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator()
|
cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator()
|
||||||
{
|
{
|
||||||
this->DriveCustomCommandsOnDepends = true;
|
this->CustomCommandDriver = OnUtility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
|
void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
|
||||||
{
|
{
|
||||||
|
@ -49,10 +48,6 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
|
||||||
this->LocalGenerator->AppendCustomDepends
|
this->LocalGenerator->AppendCustomDepends
|
||||||
(depends, this->Target->GetPreBuildCommands());
|
(depends, this->Target->GetPreBuildCommands());
|
||||||
|
|
||||||
// Build list of dependencies.
|
|
||||||
std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath();
|
|
||||||
std::string objTarget;
|
|
||||||
|
|
||||||
this->LocalGenerator->AppendCustomDepends
|
this->LocalGenerator->AppendCustomDepends
|
||||||
(depends, this->Target->GetPostBuildCommands());
|
(depends, this->Target->GetPostBuildCommands());
|
||||||
|
|
||||||
|
@ -60,17 +55,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
|
||||||
(commands, this->Target->GetPreBuildCommands());
|
(commands, this->Target->GetPreBuildCommands());
|
||||||
|
|
||||||
// Depend on all custom command outputs for sources
|
// Depend on all custom command outputs for sources
|
||||||
const std::vector<cmSourceFile*>& sources =
|
this->DriveCustomCommands(depends);
|
||||||
this->Target->GetSourceFiles();
|
|
||||||
for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
|
|
||||||
source != sources.end(); ++source)
|
|
||||||
{
|
|
||||||
if(cmCustomCommand* cc = (*source)->GetCustomCommand())
|
|
||||||
{
|
|
||||||
this->LocalGenerator->AppendCustomCommand(commands, *cc);
|
|
||||||
this->LocalGenerator->AppendCustomDepend(depends, *cc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this->LocalGenerator->AppendCustomCommands
|
this->LocalGenerator->AppendCustomCommands
|
||||||
(commands, this->Target->GetPostBuildCommands());
|
(commands, this->Target->GetPostBuildCommands());
|
||||||
|
@ -79,9 +64,8 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
|
||||||
this->AppendTargetDepends(depends);
|
this->AppendTargetDepends(depends);
|
||||||
|
|
||||||
// Add a dependency on the rule file itself.
|
// Add a dependency on the rule file itself.
|
||||||
objTarget = relPath;
|
this->LocalGenerator->AppendRuleDepend(depends,
|
||||||
objTarget += this->BuildFileName;
|
this->BuildFileNameFull.c_str());
|
||||||
this->LocalGenerator->AppendRuleDepend(depends, objTarget.c_str());
|
|
||||||
|
|
||||||
// If the rule is empty add the special empty rule dependency needed
|
// If the rule is empty add the special empty rule dependency needed
|
||||||
// by some make tools.
|
// by some make tools.
|
||||||
|
|
Loading…
Reference in New Issue