ENH: added support for forcing recomputation of depends

This commit is contained in:
Ken Martin 2005-06-10 10:45:08 -04:00
parent e1870805b4
commit e559aa11ac
6 changed files with 39 additions and 7 deletions

View File

@ -418,6 +418,22 @@ void cmGlobalUnixMakefileGenerator3
commands.push_back(lg->GetRecursiveMakeCall("Makefile2","clean")); commands.push_back(lg->GetRecursiveMakeCall("Makefile2","clean"));
lg->WriteMakeRule(makefileStream, "The main clean target", "clean", lg->WriteMakeRule(makefileStream, "The main clean target", "clean",
depends, commands); depends, commands);
// write the depend rule, really a recompute depends rule
depends.clear();
commands.clear();
std::string cmakefileName = "Makefile.cmake";
std::string runRule =
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
runRule += lg->Convert(cmakefileName.c_str(),cmLocalGenerator::NONE,
cmLocalGenerator::SHELL);
runRule += " 1";
commands.push_back(runRule);
lg->WriteMakeRule(makefileStream, "clear depends",
"depend",
depends, commands);
} }

View File

@ -135,7 +135,9 @@ public:
std::string ConvertToOutputForExisting(const char* p); std::string ConvertToOutputForExisting(const char* p);
/** Called from command-line hook to check dependencies. */ /** Called from command-line hook to check dependencies. */
virtual void CheckDependencies(cmMakefile* /* mf */, bool /* verbose */) {}; virtual void CheckDependencies(cmMakefile* /* mf */,
bool /* verbose */,
bool /* clear */) {};
/** Called from command-line hook to scan dependencies. */ /** Called from command-line hook to scan dependencies. */
virtual bool ScanDependencies(std::vector<std::string> const& /* args */) {return true;}; virtual bool ScanDependencies(std::vector<std::string> const& /* args */) {return true;};

View File

@ -1164,6 +1164,7 @@ cmLocalUnixMakefileGenerator3
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)"; "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system "; runRule += " --check-build-system ";
runRule += this->Convert(cmakefileName.c_str(),NONE,SHELL); runRule += this->Convert(cmakefileName.c_str(),NONE,SHELL);
runRule += " 0";
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
std::vector<std::string> commands; std::vector<std::string> commands;
@ -2883,7 +2884,8 @@ void cmLocalUnixMakefileGenerator3
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3::CheckDependencies(cmMakefile* mf, void cmLocalUnixMakefileGenerator3::CheckDependencies(cmMakefile* mf,
bool verbose) bool verbose,
bool clear)
{ {
// Get the list of languages that may have sources to check. // Get the list of languages that may have sources to check.
const char* langDef = mf->GetDefinition("CMAKE_DEPENDS_LANGUAGES"); const char* langDef = mf->GetDefinition("CMAKE_DEPENDS_LANGUAGES");
@ -2914,7 +2916,14 @@ void cmLocalUnixMakefileGenerator3::CheckDependencies(cmMakefile* mf,
checker(this->GetDependsChecker(*l, ".", f->c_str(), verbose)); checker(this->GetDependsChecker(*l, ".", f->c_str(), verbose));
if(checker.get()) if(checker.get())
{ {
checker->Check(); if (clear)
{
checker->Clear();
}
else
{
checker->Check();
}
} }
} }
} }

View File

@ -128,7 +128,8 @@ public:
virtual bool ScanDependencies(std::vector<std::string> const& args); virtual bool ScanDependencies(std::vector<std::string> const& args);
/** Called from command-line hook to check dependencies. */ /** Called from command-line hook to check dependencies. */
virtual void CheckDependencies(cmMakefile* mf, bool verbose); virtual void CheckDependencies(cmMakefile* mf, bool verbose,
bool clear);
/** write some extra rules suahc as make test etc */ /** write some extra rules suahc as make test etc */
void WriteSpecialTargetsTop(std::ostream& makefileStream); void WriteSpecialTargetsTop(std::ostream& makefileStream);

View File

@ -92,6 +92,8 @@ void cmNeedBackwardsCompatibility(const std::string& variable,
cmake::cmake() cmake::cmake()
{ {
m_DebugTryCompile = false; m_DebugTryCompile = false;
m_ClearBuildSystem = false;
#ifdef __APPLE__ #ifdef __APPLE__
struct rlimit rlp; struct rlimit rlp;
if(!getrlimit(RLIMIT_STACK, &rlp)) if(!getrlimit(RLIMIT_STACK, &rlp))
@ -304,6 +306,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
else if((i < args.size()-1) && (arg.find("--check-build-system",0) == 0)) else if((i < args.size()-1) && (arg.find("--check-build-system",0) == 0))
{ {
m_CheckBuildSystem = args[++i]; m_CheckBuildSystem = args[++i];
m_ClearBuildSystem = (atoi(args[++i].c_str()) > 0);
} }
else if(arg.find("-V",0) == 0) else if(arg.find("-V",0) == 0)
{ {
@ -1637,7 +1640,7 @@ int cmake::CheckBuildSystem()
{ {
std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
lgd->SetGlobalGenerator(ggd); lgd->SetGlobalGenerator(ggd);
lgd->CheckDependencies(mf, verbose); lgd->CheckDependencies(mf, verbose, m_ClearBuildSystem);
} }
// No need to rerun. // No need to rerun.

View File

@ -303,6 +303,7 @@ private:
std::string m_CXXEnvironment; std::string m_CXXEnvironment;
std::string m_CCEnvironment; std::string m_CCEnvironment;
std::string m_CheckBuildSystem; std::string m_CheckBuildSystem;
bool m_ClearBuildSystem;
bool m_DebugTryCompile; bool m_DebugTryCompile;
void UpdateConversionPathTable(); void UpdateConversionPathTable();