function buffer = getDependencyString(depTree)

%   Copyright 2014-2019 The MathWorks, Inc.

buffer = '';
border = [ '# ----------------------------------------', newline ];
for i = 1:length( depTree )
    % If there are no dependencies for this particular entry
    % then it is a "source" object which can't be built. This
    % could be either a real source file, or a link-only
    % library/obj file which has no source specified.
    if isempty( depTree( i ).TargetDeps )
        continue
    end
    % Form the comment
    str = [ newline, border, '# ', depTree( i ).TargetType, ' : ', depTree( i ).TargetFile, newline, border, newline ];
    buffer = [ buffer, str ];  %#ok<AGROW>
    % Form the macro, if there's any
    if ~isempty( depTree( i ).Macro )
        buffer = [ buffer, depTree( i ).Macro.string ];  %#ok<AGROW>
    end
    % Form the dependency line
    targetStr = [ depTree( i ).TargetFile, ' : ', depTree( i ).TargetDeps{ : }, newline ];
    buffer = [ buffer, targetStr ];  %#ok<AGROW>
end
end
