summaryrefslogtreecommitdiffstats
path: root/Source/cmDependsCompiler.cxx
diff options
context:
space:
mode:
authorKai Wang <wangkai86@huawei.com>2020-12-18 06:47:37 (GMT)
committerBrad King <brad.king@kitware.com>2021-01-05 12:48:27 (GMT)
commitb696f7807303b421c3f59ff2bf8229c96f09f1fa (patch)
tree246f99b964b4cf5b43178adde879025dc01c4c37 /Source/cmDependsCompiler.cxx
parentda2474626b8a02e957021b30453f5afc8d7246b9 (diff)
downloadCMake-b696f7807303b421c3f59ff2bf8229c96f09f1fa.zip
CMake-b696f7807303b421c3f59ff2bf8229c96f09f1fa.tar.gz
CMake-b696f7807303b421c3f59ff2bf8229c96f09f1fa.tar.bz2
cmDepends: merge dependers of depend makefile
Since one depender has multiple dependees, depend makefile generated same depender line by line, to reduce file size and refine make file parse speed, merge same dependers to one. And add a testcase for large depend.make which generated source file includes 20000 header files and run build and incremental build Signed-off-by: Wangkai <wangkai86@huawei.com> Signed-off-by: Zhaoyingdong <zhaoyingdong@huawei.com>
Diffstat (limited to 'Source/cmDependsCompiler.cxx')
-rw-r--r--Source/cmDependsCompiler.cxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx
index beb080f..97534bc 100644
--- a/Source/cmDependsCompiler.cxx
+++ b/Source/cmDependsCompiler.cxx
@@ -196,6 +196,9 @@ void cmDependsCompiler::WriteDependencies(
const auto& lineContinue = static_cast<cmGlobalUnixMakefileGenerator3*>(
this->LocalGenerator->GetGlobalGenerator())
->LineContinueDirective;
+ bool supportLongLineDepend = static_cast<cmGlobalUnixMakefileGenerator3*>(
+ this->LocalGenerator->GetGlobalGenerator())
+ ->SupportsLongLineDependencies();
const auto& binDir = this->LocalGenerator->GetBinaryDirectory();
cmDepends::DependencyMap makeDependencies(dependencies);
std::unordered_set<cm::string_view> phonyTargets;
@@ -213,13 +216,19 @@ void cmDependsCompiler::WriteDependencies(
});
bool first_dep = true;
- makeDepends << target << ": ";
+ if (supportLongLineDepend) {
+ makeDepends << target << ": ";
+ }
for (const auto& dep : deps) {
- if (first_dep) {
- first_dep = false;
- makeDepends << dep;
+ if (supportLongLineDepend) {
+ if (first_dep) {
+ first_dep = false;
+ makeDepends << dep;
+ } else {
+ makeDepends << ' ' << lineContinue << " " << dep;
+ }
} else {
- makeDepends << ' ' << lineContinue << " " << dep;
+ makeDepends << target << ": " << dep << std::endl;
}
phonyTargets.emplace(dep.data(), dep.length());