ENH: Improved dependency generation. If any cmake.depends is out of date, all of them in the tree are re-generated. This is necessary in certain cases when CMakeLists.txt files change.
This commit is contained in:
parent
16b0571d93
commit
633041837c
|
@ -99,7 +99,8 @@ void cmBorlandMakefileGenerator::OutputMakeVariables(std::ostream& fout)
|
||||||
"CMAKE_STATICLIB_SUFFIX = @CMAKE_STATICLIB_SUFFIX@\n"
|
"CMAKE_STATICLIB_SUFFIX = @CMAKE_STATICLIB_SUFFIX@\n"
|
||||||
"CMAKE_SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n"
|
"CMAKE_SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n"
|
||||||
"CMAKE_LINKER_FLAGS = @CMAKE_LINKER_FLAGS@ @LINKER_BUILD_FLAGS@\n"
|
"CMAKE_LINKER_FLAGS = @CMAKE_LINKER_FLAGS@ @LINKER_BUILD_FLAGS@\n"
|
||||||
"CMAKE_CXX_FLAGS = -P @CMAKE_CXX_FLAGS@ @BUILD_FLAGS@\n";
|
"CMAKE_CXX_FLAGS = -P @CMAKE_CXX_FLAGS@ @BUILD_FLAGS@\n"
|
||||||
|
"RM = del";
|
||||||
std::string buildType = "CMAKE_CXX_FLAGS_";
|
std::string buildType = "CMAKE_CXX_FLAGS_";
|
||||||
buildType += m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
buildType += m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
||||||
buildType = cmSystemTools::UpperCase(buildType);
|
buildType = cmSystemTools::UpperCase(buildType);
|
||||||
|
|
|
@ -155,7 +155,8 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout)
|
||||||
"CMAKE_OBJECT_FILE_SUFFIX = @CMAKE_OBJECT_FILE_SUFFIX@\n"
|
"CMAKE_OBJECT_FILE_SUFFIX = @CMAKE_OBJECT_FILE_SUFFIX@\n"
|
||||||
"CMAKE_EXECUTABLE_SUFFIX = @CMAKE_EXECUTABLE_SUFFIX@\n"
|
"CMAKE_EXECUTABLE_SUFFIX = @CMAKE_EXECUTABLE_SUFFIX@\n"
|
||||||
"CMAKE_STATICLIB_SUFFIX = @CMAKE_STATICLIB_SUFFIX@\n"
|
"CMAKE_STATICLIB_SUFFIX = @CMAKE_STATICLIB_SUFFIX@\n"
|
||||||
"CMAKE_SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n";
|
"CMAKE_SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n"
|
||||||
|
"RM = del\n";
|
||||||
|
|
||||||
std::string buildType = "CMAKE_CXX_FLAGS_";
|
std::string buildType = "CMAKE_CXX_FLAGS_";
|
||||||
buildType += m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
buildType += m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
||||||
|
|
|
@ -249,7 +249,7 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
|
||||||
"Default target executed when no arguments are given to make",
|
"Default target executed when no arguments are given to make",
|
||||||
"default_target",
|
"default_target",
|
||||||
0,
|
0,
|
||||||
"$(MAKE) -$(MAKEFLAGS) cmake.depends",
|
"$(MAKE) -$(MAKEFLAGS) cmake.depends_mark",
|
||||||
"$(MAKE) -$(MAKEFLAGS) all");
|
"$(MAKE) -$(MAKEFLAGS) all");
|
||||||
|
|
||||||
this->OutputTargetRules(fout);
|
this->OutputTargetRules(fout);
|
||||||
|
@ -584,7 +584,7 @@ void cmUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
|
||||||
std::string depend = "$(";
|
std::string depend = "$(";
|
||||||
depend += name;
|
depend += name;
|
||||||
depend += "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)";
|
depend += "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)";
|
||||||
std::string command = "rm -f lib";
|
std::string command = "$(RM) lib";
|
||||||
command += name;
|
command += name;
|
||||||
command += "$(SHLIB_SUFFIX)";
|
command += "$(SHLIB_SUFFIX)";
|
||||||
std::string command2 = "$(CMAKE_CXX_COMPILER) $(CMAKE_SHLIB_LINK_FLAGS) "
|
std::string command2 = "$(CMAKE_CXX_COMPILER) $(CMAKE_SHLIB_LINK_FLAGS) "
|
||||||
|
@ -618,7 +618,7 @@ void cmUnixMakefileGenerator::OutputModuleLibraryRule(std::ostream& fout,
|
||||||
std::string target = m_LibraryOutputPath + "lib" + std::string(name) + "$(MODULE_SUFFIX)";
|
std::string target = m_LibraryOutputPath + "lib" + std::string(name) + "$(MODULE_SUFFIX)";
|
||||||
std::string depend = "$(";
|
std::string depend = "$(";
|
||||||
depend += std::string(name) + "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)";
|
depend += std::string(name) + "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)";
|
||||||
std::string command = "rm -f lib" + std::string(name) + "$(MODULE_SUFFIX)";
|
std::string command = "$(RM) lib" + std::string(name) + "$(MODULE_SUFFIX)";
|
||||||
std::string command2 = "$(CMAKE_CXX_COMPILER) $(CMAKE_MODULE_LINK_FLAGS) "
|
std::string command2 = "$(CMAKE_CXX_COMPILER) $(CMAKE_MODULE_LINK_FLAGS) "
|
||||||
"$(CMAKE_MODULE_BUILD_FLAGS) $(CMAKE_CXX_FLAGS) -o \\\n";
|
"$(CMAKE_MODULE_BUILD_FLAGS) $(CMAKE_CXX_FLAGS) -o \\\n";
|
||||||
command2 += "\t ";
|
command2 += "\t ";
|
||||||
|
@ -972,7 +972,7 @@ void cmUnixMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
|
||||||
{
|
{
|
||||||
fout << "\t@if test ! -d " << directory
|
fout << "\t@if test ! -d " << directory
|
||||||
<< "; then $(MAKE) rebuild_cache; fi\n"
|
<< "; then $(MAKE) rebuild_cache; fi\n"
|
||||||
"\tcd " << directory
|
"\t@cd " << directory
|
||||||
<< "; $(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
|
<< "; $(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
|
||||||
}
|
}
|
||||||
if(target2)
|
if(target2)
|
||||||
|
@ -1048,7 +1048,7 @@ void cmUnixMakefileGenerator::OutputSubDirectoryRules(std::ostream& fout)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->OutputSubDirectoryVars(fout, "SUBDIR_BUILD", "build",
|
this->OutputSubDirectoryVars(fout, "SUBDIR_BUILD", "build",
|
||||||
"cmake.depends",
|
"cmake.depends_mark",
|
||||||
"all",
|
"all",
|
||||||
SubDirectories);
|
SubDirectories);
|
||||||
this->OutputSubDirectoryVars(fout, "SUBDIR_CLEAN", "clean",
|
this->OutputSubDirectoryVars(fout, "SUBDIR_CLEAN", "clean",
|
||||||
|
@ -1279,6 +1279,7 @@ void cmUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
|
||||||
"SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n"
|
"SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n"
|
||||||
"MODULE_SUFFIX = @CMAKE_MODULE_SUFFIX@\n"
|
"MODULE_SUFFIX = @CMAKE_MODULE_SUFFIX@\n"
|
||||||
"THREAD_LIBS = @CMAKE_THREAD_LIBS@\n"
|
"THREAD_LIBS = @CMAKE_THREAD_LIBS@\n"
|
||||||
|
"RM = rm -f\n"
|
||||||
"\n"
|
"\n"
|
||||||
"# set up the path to the rulesgen program\n"
|
"# set up the path to the rulesgen program\n"
|
||||||
"CMAKE_COMMAND = ${CMAKE_COMMAND}"
|
"CMAKE_COMMAND = ${CMAKE_COMMAND}"
|
||||||
|
@ -1474,7 +1475,7 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
|
||||||
this->OutputMakeRule(fout,
|
this->OutputMakeRule(fout,
|
||||||
"Default build rule",
|
"Default build rule",
|
||||||
"all",
|
"all",
|
||||||
"cmake.depends $(TARGETS) $(SUBDIR_BUILD)",
|
"cmake.depends_mark $(TARGETS) $(SUBDIR_BUILD)",
|
||||||
0);
|
0);
|
||||||
if (m_Makefile->IsOn("QT_WRAP_CPP") ||
|
if (m_Makefile->IsOn("QT_WRAP_CPP") ||
|
||||||
m_Makefile->IsOn("QT_WRAP_UI") ||
|
m_Makefile->IsOn("QT_WRAP_UI") ||
|
||||||
|
@ -1484,7 +1485,7 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
|
||||||
"remove generated files and dependency file",
|
"remove generated files and dependency file",
|
||||||
"clean",
|
"clean",
|
||||||
"$(SUBDIR_CLEAN)",
|
"$(SUBDIR_CLEAN)",
|
||||||
"rm -f $(CLEAN_OBJECT_FILES) $(EXECUTABLES)"
|
"-@ $(RM) $(CLEAN_OBJECT_FILES) $(EXECUTABLES)"
|
||||||
" $(TARGETS) ${GENERATED_QT_FILES}"
|
" $(TARGETS) ${GENERATED_QT_FILES}"
|
||||||
" ${GENERATED_FLTK_FILES}",
|
" ${GENERATED_FLTK_FILES}",
|
||||||
"make depend");
|
"make depend");
|
||||||
|
@ -1495,23 +1496,27 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
|
||||||
"remove generated files",
|
"remove generated files",
|
||||||
"clean",
|
"clean",
|
||||||
"$(SUBDIR_CLEAN)",
|
"$(SUBDIR_CLEAN)",
|
||||||
"rm -f $(CLEAN_OBJECT_FILES) $(EXECUTABLES)"
|
"-@ $(RM) $(CLEAN_OBJECT_FILES) $(EXECUTABLES)"
|
||||||
" $(TARGETS)");
|
" $(TARGETS)");
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
std::string cmake_depends_mark = "@cd ";
|
||||||
|
cmake_depends_mark += m_Makefile->GetHomeOutputDirectory();
|
||||||
|
cmake_depends_mark += " ; $(MAKE) depend";
|
||||||
this->OutputMakeRule(fout,
|
this->OutputMakeRule(fout,
|
||||||
"Rule to build the cmake.depends and Makefile as side effect",
|
"Rule to build the cmake.depends and Makefile as side effect",
|
||||||
"cmake.depends",
|
"cmake.depends_mark",
|
||||||
"$(CMAKE_MAKEFILE_SOURCES) ",
|
"$(CMAKE_MAKEFILE_SOURCES) ",
|
||||||
"$(CMAKE_COMMAND) "
|
cmake_depends_mark.c_str());
|
||||||
"-S$(CMAKE_CURRENT_SOURCE) -O$(CMAKE_CURRENT_BINARY) "
|
}
|
||||||
"-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)");
|
|
||||||
this->OutputMakeRule(fout,
|
this->OutputMakeRule(fout,
|
||||||
"Rule to force the build of cmake.depends",
|
"Rule to force the build of cmake.depends",
|
||||||
"depend",
|
"depend",
|
||||||
"$(SUBDIR_DEPEND)",
|
"$(SUBDIR_DEPEND)",
|
||||||
"$(CMAKE_COMMAND) "
|
"$(CMAKE_COMMAND) "
|
||||||
"-S$(CMAKE_CURRENT_SOURCE) -O$(CMAKE_CURRENT_BINARY) "
|
"-S$(CMAKE_CURRENT_SOURCE) -O$(CMAKE_CURRENT_BINARY) "
|
||||||
"-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)");
|
"-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)\n"
|
||||||
|
"\t-@ $(RM) cmake.depends_mark ; echo mark > cmake.depends_mark");
|
||||||
this->OutputMakeRule(fout,
|
this->OutputMakeRule(fout,
|
||||||
"Rebuild CMakeCache.txt file",
|
"Rebuild CMakeCache.txt file",
|
||||||
"rebuild_cache",
|
"rebuild_cache",
|
||||||
|
|
Loading…
Reference in New Issue