diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-07-06 18:41:18 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-07-06 18:41:18 (GMT) |
commit | a1ec2852af9508016fae37e425de70265a949cb7 (patch) | |
tree | 16e868b9f6bd1cb6ead21506f406066d539ac6af | |
parent | f1892133c9a9d93742856e5f07f62c676604dfd6 (diff) | |
download | CMake-a1ec2852af9508016fae37e425de70265a949cb7.zip CMake-a1ec2852af9508016fae37e425de70265a949cb7.tar.gz CMake-a1ec2852af9508016fae37e425de70265a949cb7.tar.bz2 |
ENH: some clean up, and better checking to see if we are building cmake
-rw-r--r-- | Source/cmUnixMakefileGenerator.cxx | 41 | ||||
-rw-r--r-- | Source/cmUnixMakefileGenerator.h | 1 |
2 files changed, 33 insertions, 9 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 4362d2a..802c128 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -1123,8 +1123,34 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout) 0, "${CMAKE_COMMAND} " "-H${CMAKE_SOURCE_DIR} -B${CMAKE_BINARY_DIR}"); + + this->OutputMakeRule(fout, + "Rule to keep make from removing Makefiles " + "if control-C is hit during a run of cmake.", + ".PRECIOUS", + "Makefile cmake.depends", + 0); + + this->OutputSourceObjectBuildRules(fout); + // see if there is already a target for a cmake executable in this + // makefile + bool buildingCMake = false; + std::map<std::string, cmTarget>& targets = m_Makefile->GetTargets(); + for(cmTargets::const_iterator l = targets.begin(); + l != targets.end(); l++) + { + if ((l->second.GetType() == cmTarget::EXECUTABLE || + l->second.GetType() == cmTarget::WIN32_EXECUTABLE) && + l->second.IsInAll()) + { + if(l->first == "cmake") + { + buildingCMake = true; + } + } + } // do not put this command in for the cmake project - if(strcmp(m_Makefile->GetProjectName(), "CMake") != 0) + if(!buildingCMake) { this->OutputMakeRule(fout, "Rebuild cmake dummy rule", @@ -1132,14 +1158,11 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout) 0, "echo \"cmake might be out of date\""); } - this->OutputMakeRule(fout, - "Rule to keep make from removing Makefiles " - "if control-C is hit during a run of cmake.", - ".PRECIOUS", - "Makefile cmake.depends", - 0); - +} + +void cmUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fout) +{ fout << "# Rules to build .o files from their sources:\n"; std::set<std::string> rules; @@ -1155,7 +1178,7 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout) for(std::vector<cmSourceFile>::const_iterator source = sources.begin(); source != sources.end(); ++source) { - if(!source->IsAHeaderFileOnly()) + if(!source->IsAHeaderFileOnly()) { std::string shortName; std::string sourceName; diff --git a/Source/cmUnixMakefileGenerator.h b/Source/cmUnixMakefileGenerator.h index 82230bc..db3b450 100644 --- a/Source/cmUnixMakefileGenerator.h +++ b/Source/cmUnixMakefileGenerator.h @@ -106,6 +106,7 @@ private: void OutputMakeVariables(std::ostream&); void OutputMakeRules(std::ostream&); void OutputInstallRules(std::ostream&); + void OutputSourceObjectBuildRules(std::ostream& fout); void OutputSubDirectoryVars(std::ostream& fout, const char* var, const char* target, |