diff options
Diffstat (limited to 'Source/cmDependsC.cxx')
-rw-r--r-- | Source/cmDependsC.cxx | 31 |
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; } |