summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-27 17:06:56 (GMT)
committerBrad King <brad.king@kitware.com>2019-09-27 18:15:00 (GMT)
commit156b56480a786db4d967bde5eb6d5edee56a27d0 (patch)
tree903d26d8951dc566313065625f52052c04711485 /Source/cmGlobalUnixMakefileGenerator3.cxx
parent26a0e200e5f4abe8268235c9fdb23a2612a1b3b1 (diff)
downloadCMake-156b56480a786db4d967bde5eb6d5edee56a27d0.zip
CMake-156b56480a786db4d967bde5eb6d5edee56a27d0.tar.gz
CMake-156b56480a786db4d967bde5eb6d5edee56a27d0.tar.bz2
Makefiles: Revert "Make build root targets ... recursive"
Revert the main logic change from commit 827da1119e (Makefiles: Make build root targets "all", "clean" and "preinstall" recursive, 2019-05-17, v3.15.0-rc1~96^2~2) for the "all" and "preinstall" targets. The commit cleaned up the Makefile generator to use the same logic for the "all" target in the top-level directory as for subdirectories. It exposed a long-existing bug that caused the "all" target in a subdirectory to include the "all" targets from sub-subdirectories even if they are marked `EXCLUDE_FROM_ALL`. The `Tests/SubDir` test should fail but the problem is currently covered up by another bug introduced by commit dc6888573d (Pass EXCLUDE_FROM_ALL from directory to targets, 2019-01-15, v3.14.0-rc1~83^2) that causes the "all" targets in `EXCLUDE_FROM_ALL` subdirectories to be empty. Revert the top-level "all" and "preinstall" targets to the old approach to prepare to fix the latter bug without exposing the long-existing bug at the top-level. Leave the "clean" target in the new approach because it does not honor `EXCLUDE_FROM_ALL` anyway. Issue: #19753
Diffstat (limited to 'Source/cmGlobalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx29
1 files changed, 24 insertions, 5 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index aa584ad..c636334 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -232,6 +232,14 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
depends.push_back(this->EmptyRuleHackDepends);
}
+ // Write and empty all:
+ lg->WriteMakeRule(makefileStream, "The main recursive all target", "all",
+ depends, no_commands, true);
+
+ // Write an empty preinstall:
+ lg->WriteMakeRule(makefileStream, "The main recursive preinstall target",
+ "preinstall", depends, no_commands, true);
+
// Write out the "special" stuff
lg->WriteSpecialTargetsTop(makefileStream);
@@ -473,8 +481,13 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2(
ruleFileStream << "\n\n";
}
- // Write directory-level rules for "all".
- this->WriteDirectoryRule2(ruleFileStream, lg, "all", true, false);
+ if (!lg->IsRootMakefile()) {
+ // Write directory-level rules for "all".
+ this->WriteDirectoryRule2(ruleFileStream, lg, "all", true, false);
+
+ // Write directory-level rules for "preinstall".
+ this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", true, true);
+ }
// Write directory-level rules for "clean".
{
@@ -482,9 +495,6 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2(
lg->AppendDirectoryCleanCommand(cmds);
this->WriteDirectoryRule2(ruleFileStream, lg, "clean", false, false, cmds);
}
-
- // Write directory-level rules for "preinstall".
- this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", true, true);
}
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
@@ -707,6 +717,15 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
localName, depends, commands, true);
+ // add the all/all dependency
+ if (!this->IsExcluded(gtarget)) {
+ depends.clear();
+ depends.push_back(localName);
+ commands.clear();
+ lg->WriteMakeRule(ruleFileStream, "Include target in all.", "all",
+ depends, commands, true);
+ }
+
// Write the rule.
commands.clear();