function setBuilderApplication(h,platform)

%   Copyright 2014-2020 The MathWorks, Inc.
    
platform = convertStringsToChars(platform);
tool = h.BuilderApplication;
switch h.BuildArtifactType
    case coder.make.enum.BuildArtifact.GMAKE_MAKEFILE
        isPCPlatform = any( strcmpi( platform, { 'win32', 'win64' } ) );
        isUnixPlatform = any( strcmpi( platform, { 'glnxa64', 'maci64' } ) );
        if isPCPlatform
            pathfs = '\';
            deleteCommand = '@del /F';
            moveCommand = '@move';
        elseif isUnixPlatform
            pathfs = '/';
            deleteCommand = '@rm -f';
            moveCommand = '@mv';
        else
            assert( false, [ '"', platform, '" is not a supported platform.' ] )
        end
        cmdPath = [ '%MATLAB%', pathfs, 'bin', pathfs, platform ];
        tool.setName( 'GMAKE Utility' );
        tool.setCommand( 'gmake' );
        tool.setPath( cmdPath );
        tool.setDirective( 'IncludeFile', '-include' );
        tool.setDirective( 'LineContinuation', '\' );
        tool.setDirective( 'FileSeparator', '/' );
        tool.setDirective( 'Comment', '#' );
        tool.setDirective( 'DeleteCommand', deleteCommand );
        tool.setDirective( 'DisplayCommand', '@echo' );
        tool.setDirective( 'MoveCommand', moveCommand );
        tool.setDirective( 'RunScriptCommand', '' );
        tool.setDirective( 'ReferencePattern', '\$\($1\)' );
        tool.setFileExtension( 'Makefile', '.mk' );
        tool.setCommandPattern( '|>TOOL<| |>TOOL_OPTIONS<|' );
        h.setBuildConfigurationOption( 'all', 'Make Tool', '-f $(MAKEFILE)' );
    case coder.make.enum.BuildArtifact.NMAKE_MAKEFILE
        tool.setName( 'NMAKE Utility' );
        tool.setCommand( 'nmake' );
        tool.setPath( '' );
        tool.setDirective( 'IncludeFile', '!include' );
        tool.setDirective( 'LineContinuation', '\' );
        tool.setDirective( 'FileSeparator', '\' );
        tool.setDirective( 'Comment', '#' );
        tool.setDirective( 'DeleteCommand', '@del' );
        tool.setDirective( 'DisplayCommand', '@echo' );
        tool.setDirective( 'MoveCommand', '@ren' );
        tool.setDirective( 'RunScriptCommand', '@cmd /C' );
        tool.setDirective( 'ReferencePattern', '\$\($1\)' );
        tool.setFileExtension( 'Makefile', '.mk' );
        tool.setCommandPattern( '|>TOOL<| |>TOOL_OPTIONS<|' );
        h.setBuildConfigurationOption( 'all', 'Make Tool', '-f $(MAKEFILE)' );
    otherwise
        % Do not error. This may be called even if the
        % BuildType is 'custom makefile'
        % error(message('coder_compile:toolchain:UnsupportedBuildArtifactTool', makeToolName));
end
end
