function [tmf,envVal,mexOpts] = get_tmf_for_target(target, comp)
%GET_TMF_FOR_TARGET Returns the default template makefile on for given target
%
% On Unix systems, the default template makefile is <target>_unix.tmf.
% On PC systems, the default template makefile is determined by
% examining mexopts.bat. For example, it will be <target>_vcx64.tmf.

% Copyright 1994-2020 The MathWorks, Inc.

% These return arguments are no longer used, but the signature of get_tmf_for_target
% is being preserved to maintain compatibility with custom code.
envVal = '';
mexOpts = [];

if nargin < 2
comp = [];
end

if isunix
suffix = '_unix.tmf';
else
if isempty(comp)

compUpdated = coder.make.internal.getMexCompilerInfo('tmfCompatible');

if isempty(compUpdated)
if ispc
suffix = '_lcc64.tmf';
end
else
suffix = compUpdated.suffix;
end
elseif strcmp(comp.compStr, 'GNU-x') || strncmpi(comp.compStr, 'Intel', 5)
% No TMF support for mingw or Intel: cannot honor default mex compiler therefore choose a different installed
% compiler
tmfCompList = coder.make.internal.getMexCompilerInfo('getInstalledManVerStrings', ...
'tmfcompatible');
if ~isempty(tmfCompList)
compStrOther = tmfCompList{1};
mexCompInfoOther = coder.make.internal.getMexCompInfoFromKey(compStrOther);
suffix = mexCompInfoOther.suffix;
else
suffix = '_lcc64.tmf';
end
else
suffix = comp.suffix;
end
end
tmf = [target suffix];

% LocalWords: mingw tmfcompatible