diff options
author | Brad King <brad.king@kitware.com> | 2005-03-08 20:55:13 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2005-03-08 20:55:13 (GMT) |
commit | 778c4940decfc754637afe50e9f98c775c212c2c (patch) | |
tree | 5ccf1ee431ca13bc73441da43b5967a0eb34f092 /Source/cmLocalUnixMakefileGenerator2.cxx | |
parent | b8e7851b185a477cf79ad9cb987b43bf2ba320a1 (diff) | |
download | CMake-778c4940decfc754637afe50e9f98c775c212c2c.zip CMake-778c4940decfc754637afe50e9f98c775c212c2c.tar.gz CMake-778c4940decfc754637afe50e9f98c775c212c2c.tar.bz2 |
ENH: Adding extra dependencies to jump-and-build rules that force a single ordering to prevent parallel jumps. This avoids problems with two jumps reaching the same target in parallel which happened occasionally with the old generator.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator2.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator2.cxx | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator2.cxx b/Source/cmLocalUnixMakefileGenerator2.cxx index 5cc63e8..33e7085 100644 --- a/Source/cmLocalUnixMakefileGenerator2.cxx +++ b/Source/cmLocalUnixMakefileGenerator2.cxx @@ -3061,18 +3061,31 @@ cmLocalUnixMakefileGenerator2 makefileStream << "# Targets to make sure needed libraries exist.\n" << "# These will jump to other directories to build targets.\n" + << "# Note that extra dependencies are added to enforce an ordering\n" + << "# that prevents parallel jumps.\n" << "\n"; } - std::vector<std::string> depends; - std::vector<std::string> commands; + // Keep track of the last jump target written. + std::string lastJump; + + // Add each jump rule. for(std::map<cmStdString, RemoteTarget>::iterator jump = m_JumpAndBuild.begin(); jump != m_JumpAndBuild.end(); ++jump) { const cmLocalUnixMakefileGenerator2::RemoteTarget& rt = jump->second; const char* destination = rt.m_BuildDirectory.c_str(); - // Construct the dependency and build target names. + // Depend on the previously written jump rule to make sure only + // one jump happens at a time. This avoids problems with multiple + // jump paths leading to the same target at the same time. + std::vector<std::string> depends; + if(!lastJump.empty()) + { + depends.push_back(lastJump); + } + + // Construct the dependency and build target names for the destination. std::string dep = jump->first; dep += ".dir/"; dep += jump->first; @@ -3083,7 +3096,7 @@ cmLocalUnixMakefileGenerator2 tgt = this->ConvertToRelativeOutputPath(tgt.c_str()); // Add the pre-jump message. - commands.clear(); + std::vector<std::string> commands; std::string jumpPreEcho = "Jumping to "; jumpPreEcho += rt.m_BuildDirectory.c_str(); jumpPreEcho += " to build "; @@ -3147,6 +3160,9 @@ cmLocalUnixMakefileGenerator2 // Write the rule. this->WriteMakeRule(makefileStream, 0, rt.m_FilePath.c_str(), depends, commands); + + // This is now the last jump target written. + lastJump = rt.m_FilePath; } } |