diff options
-rw-r--r-- | Source/cmDependsFortran.cxx | 9 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 22 |
2 files changed, 28 insertions, 3 deletions
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index ca2d388..c818ec6 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -185,6 +185,15 @@ bool cmDependsFortran::WriteDependencies(std::ostream& os) os << "\t@touch " << m_TargetFile.c_str() << ".provides\n"; } + // if it provides something then connect the requires rule to the build rule + if(!parser.Provides.empty()) + { + os << m_TargetFile.c_str() << ".requires: " << m_TargetFile.c_str() + << ".requires.build" << std::endl; + // provide empty build rule for old gen for now, TODO remove later + os << m_TargetFile.c_str() << ".requires.build:" << std::endl; + } + /* // TODO: What about .mod files provided in another directory and found with a diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9d275fe..9f9e47f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -625,15 +625,20 @@ cmLocalUnixMakefileGenerator3 // If the language needs provides-requires mode, create the // corresponding targets. + std::string objectRequires = obj; + objectRequires += ".requires"; + std::vector<std::string> no_commands; + + // always provide an empty requires target + this->WriteMakeRule(ruleFileStream, 0, + objectRequires.c_str(), no_commands, no_commands); + if(strcmp(lang, "Fortran") == 0) { - std::string objectRequires = obj; std::string objectProvides = obj; - objectRequires += ".requires"; objectProvides += ".provides"; { // Add the provides target to build the object file. - std::vector<std::string> no_commands; std::vector<std::string> p_depends; p_depends.push_back(obj); this->WriteMakeRule(ruleFileStream, 0, @@ -642,7 +647,18 @@ cmLocalUnixMakefileGenerator3 // Add this to the set of provides-requires objects on the target. provides_requires.push_back(objectRequires); + { + // Add the requires.build target to recursively build the provides + // target after needed information is up to date. + std::vector<std::string> no_depends; + std::vector<std::string> r_commands; + r_commands.push_back(this->GetRecursiveMakeCall("Makefile",objectProvides.c_str())); + objectRequires += ".build"; + this->WriteMakeRule(ruleFileStream, 0, + objectRequires.c_str(), no_depends, r_commands); } + } + } //---------------------------------------------------------------------------- |