From e79b73d61f7523cf6ce4d989995ede808da212df Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 3 Jun 2008 09:55:28 -0400 Subject: BUG: Include less content as input to "rule hash" computation. - The rule hash should use only commands specified by the user. - No make output (echo and progress) rules should be included. - No outputs or dependencies need be included. The native build tool will take care of them. --- Source/cmGlobalGenerator.cxx | 21 +++------------------ Source/cmGlobalGenerator.h | 4 ++-- Source/cmMakefileTargetGenerator.cxx | 8 +++++++- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b971298..f34888f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1943,8 +1943,8 @@ cmGlobalGenerator::GetDirectoryContent(std::string const& dir, bool needDisk) //---------------------------------------------------------------------------- void cmGlobalGenerator::AddRuleHash(const std::vector& outputs, - const std::vector& depends, - const std::vector& commands) + std::vector::const_iterator first, + std::vector::const_iterator last) { #if defined(CMAKE_BUILD_WITH_CMAKE) // Ignore if there are no outputs. @@ -1960,22 +1960,7 @@ cmGlobalGenerator::AddRuleHash(const std::vector& outputs, int length; cmsysMD5* sum = cmsysMD5_New(); cmsysMD5_Initialize(sum); - for(std::vector::const_iterator i = outputs.begin(); - i != outputs.end(); ++i) - { - data = reinterpret_cast(i->c_str()); - length = static_cast(i->length()); - cmsysMD5_Append(sum, data, length); - } - for(std::vector::const_iterator i = depends.begin(); - i != depends.end(); ++i) - { - data = reinterpret_cast(i->c_str()); - length = static_cast(i->length()); - cmsysMD5_Append(sum, data, length); - } - for(std::vector::const_iterator i = commands.begin(); - i != commands.end(); ++i) + for(std::vector::const_iterator i = first; i != last; ++i) { data = reinterpret_cast(i->c_str()); length = static_cast(i->length()); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ae9a46d..2865a38 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -246,8 +246,8 @@ public: void GetFilesReplacedDuringGenerate(std::vector& filenames); void AddRuleHash(const std::vector& outputs, - const std::vector& depends, - const std::vector& commands); + std::vector::const_iterator first, + std::vector::const_iterator last); protected: // for a project collect all its targets by following depend diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index ea0d9b8..7d2450d 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1116,6 +1116,10 @@ void cmMakefileTargetGenerator ->AppendEcho(commands, comment.c_str(), cmLocalUnixMakefileGenerator3::EchoGenerate); } + // Below we need to skip over the echo and progress commands. + unsigned int skip = static_cast(commands.size()); + + // Now append the actual user-specified commands. this->LocalGenerator->AppendCustomCommand(commands, cc); // Collect the dependencies. @@ -1144,7 +1148,9 @@ void cmMakefileTargetGenerator // If the rule has changed make sure the output is rebuilt. if(!symbolic) { - this->GlobalGenerator->AddRuleHash(cc.GetOutputs(), depends, commands); + this->GlobalGenerator->AddRuleHash(cc.GetOutputs(), + commands.begin()+skip, + commands.end()); } } -- cgit v0.12