summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-12-28 11:00:05 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-01-09 10:35:17 (GMT)
commitbb64ea5741f599567bf282b32431e852b28e31bc (patch)
tree778cb17de7167e4b9000feba53a76bd6e9fb5c19 /Source/cmMakefileTargetGenerator.cxx
parent8ec7408d745a9e17a1e35a4e97e9ab33044832c9 (diff)
downloadCMake-bb64ea5741f599567bf282b32431e852b28e31bc.zip
CMake-bb64ea5741f599567bf282b32431e852b28e31bc.tar.gz
CMake-bb64ea5741f599567bf282b32431e852b28e31bc.tar.bz2
Makefiles: ensure transparent switch between dependencies strategies
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx63
1 files changed, 39 insertions, 24 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index c33fabd..adf40b0 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -345,27 +345,51 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
this->LocalGenerator->GetBinaryDirectory(), compilerDependFile))
<< "\n\n";
- if (!cmSystemTools::FileExists(compilerDependFile)) {
- // Write an empty dependency file.
- cmGeneratedFileStream depFileStream(
- compilerDependFile, false,
- this->GlobalGenerator->GetMakefileEncoding());
- depFileStream << "# Empty compiler generated dependencies file for "
- << this->GeneratorTarget->GetName() << ".\n"
- << "# This may be replaced when dependencies are built.\n";
- }
+ // Write an empty dependency file.
+ cmGeneratedFileStream depFileStream(
+ compilerDependFile, false, this->GlobalGenerator->GetMakefileEncoding());
+ depFileStream << "# Empty compiler generated dependencies file for "
+ << this->GeneratorTarget->GetName() << ".\n"
+ << "# This may be replaced when dependencies are built.\n";
+ // remove internal dependency file
+ cmSystemTools::RemoveFile(
+ cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.internal"));
std::string compilerDependTimestamp =
cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.ts");
if (!cmSystemTools::FileExists(compilerDependTimestamp)) {
// Write a dependency timestamp file.
- cmGeneratedFileStream depFileStream(
+ cmGeneratedFileStream timestampFileStream(
compilerDependTimestamp, false,
this->GlobalGenerator->GetMakefileEncoding());
- depFileStream << "# CMAKE generated file: DO NOT EDIT!\n"
- << "# Timestamp file for compiler generated dependencies "
- "management for "
- << this->GeneratorTarget->GetName() << ".\n";
+ timestampFileStream
+ << "# CMAKE generated file: DO NOT EDIT!\n"
+ << "# Timestamp file for compiler generated dependencies "
+ "management for "
+ << this->GeneratorTarget->GetName() << ".\n";
+ }
+
+ // deactivate no longer needed legacy dependency files
+ // Write an empty dependency file.
+ cmGeneratedFileStream legacyDepFileStream(
+ dependFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding());
+ legacyDepFileStream
+ << "# Empty dependencies file for " << this->GeneratorTarget->GetName()
+ << ".\n"
+ << "# This may be replaced when dependencies are built.\n";
+ // remove internal dependency file
+ cmSystemTools::RemoveFile(
+ cmStrCat(this->TargetBuildDirectoryFull, "/depend.internal"));
+ } else {
+ // make sure the depend file exists
+ if (!cmSystemTools::FileExists(dependFileNameFull)) {
+ // Write an empty dependency file.
+ cmGeneratedFileStream depFileStream(
+ dependFileNameFull, false,
+ this->GlobalGenerator->GetMakefileEncoding());
+ depFileStream << "# Empty dependencies file for "
+ << this->GeneratorTarget->GetName() << ".\n"
+ << "# This may be replaced when dependencies are built.\n";
}
}
@@ -381,16 +405,6 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< "\n\n";
}
- // make sure the depend file exists
- if (!cmSystemTools::FileExists(dependFileNameFull)) {
- // Write an empty dependency file.
- cmGeneratedFileStream depFileStream(
- dependFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding());
- depFileStream << "# Empty dependencies file for "
- << this->GeneratorTarget->GetName() << ".\n"
- << "# This may be replaced when dependencies are built.\n";
- }
-
// Open the flags file. This should be copy-if-different because the
// rules may depend on this file itself.
this->FlagFileNameFull =
@@ -855,6 +869,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
shellDependencyFile = this->LocalGenerator->ConvertToOutputFormat(
depFile, cmOutputConverter::SHELL);
vars.DependencyFile = shellDependencyFile.c_str();
+ this->CleanFiles.insert(depFile);
dependencyTimestamp = this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetBinaryDirectory(),