summaryrefslogtreecommitdiffstats
path: root/Source/cmDependsC.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-01-06 15:19:33 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-01-06 15:20:04 (GMT)
commitc1a7de72e1815cecf825d833161bc938afff65ee (patch)
tree57884f0bae7eaf867c2eebcf850ac47bf691376b /Source/cmDependsC.cxx
parent6493d3709166fc7db7a427f752e619b70415704d (diff)
parentb696f7807303b421c3f59ff2bf8229c96f09f1fa (diff)
downloadCMake-c1a7de72e1815cecf825d833161bc938afff65ee.zip
CMake-c1a7de72e1815cecf825d833161bc938afff65ee.tar.gz
CMake-c1a7de72e1815cecf825d833161bc938afff65ee.tar.bz2
Merge topic 'depend_make_refine'
b696f78073 cmDepends: merge dependers of depend makefile Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5631
Diffstat (limited to 'Source/cmDependsC.cxx')
-rw-r--r--Source/cmDependsC.cxx31
1 files changed, 22 insertions, 9 deletions
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index e6aef92..60e8cbf 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -7,6 +7,7 @@
#include "cmsys/FStream.hxx"
#include "cmFileTime.h"
+#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmProperty.h"
@@ -215,16 +216,28 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// directory. We must do the same here.
std::string obj_m = this->LocalGenerator->ConvertToMakefilePath(obj_i);
internalDepends << obj_i << '\n';
-
- for (std::string const& dep : dependencies) {
- makeDepends << obj_m << ": "
- << this->LocalGenerator->ConvertToMakefilePath(
- this->LocalGenerator->MaybeConvertToRelativePath(binDir,
- dep))
- << '\n';
- internalDepends << ' ' << dep << '\n';
+ if (!dependencies.empty()) {
+ const auto& lineContinue = static_cast<cmGlobalUnixMakefileGenerator3*>(
+ this->LocalGenerator->GetGlobalGenerator())
+ ->LineContinueDirective;
+ bool supportLongLineDepend = static_cast<cmGlobalUnixMakefileGenerator3*>(
+ this->LocalGenerator->GetGlobalGenerator())
+ ->SupportsLongLineDependencies();
+ if (supportLongLineDepend) {
+ makeDepends << obj_m << ':';
+ }
+ for (std::string const& dep : dependencies) {
+ std::string dependee = this->LocalGenerator->ConvertToMakefilePath(
+ this->LocalGenerator->MaybeConvertToRelativePath(binDir, dep));
+ if (supportLongLineDepend) {
+ makeDepends << ' ' << lineContinue << ' ' << dependee;
+ } else {
+ makeDepends << obj_m << ": " << dependee << '\n';
+ }
+ internalDepends << ' ' << dep << '\n';
+ }
+ makeDepends << '\n';
}
- makeDepends << '\n';
return true;
}