function initialize(h,varargin)

%   Copyright 2014-2020 The MathWorks, Inc.

param = parseInputArgs( varargin );
% Initialize basic properties
h.Name = param.Name;
h.Revision = param.Revision;
h.Platform = param.Platform;
h.SupportedVersion = param.SupportedVersion;
% Initialize some properties based on inputs
h.SupportedLanguages = param.SupportedLanguages;
h.setBuildArtifactProperties( param.BuildArtifact, param.BuildArtifactWriter, param.BuildArtifactExecutor );
% Initialize all other properties
h.BuildTools = h.createOrderedList( 'coder.make.BuildTool', 'BuildTools' );
h.PrebuildTools = h.createOrderedList( 'coder.make.BuildTool', 'PrebuildTools' );
h.PostbuildTools = h.createOrderedList( 'coder.make.BuildTool', 'PostbuildTools' );
h.BuilderApplication = h.createBuildTool();
h.BuildConfigurations = h.createUnorderedList( 'coder.make.BuildConfiguration', 'BuildConfigurations' );
h.Macros = h.createOrderedList( { 'char', 'double' }, 'Macros' );
h.Attributes = h.createUnorderedList( [  ], 'Attributes' );
h.CustomBuildConfigurations = [  ];
if param.InitOnly
    return
end
% Set the format version to MATLAB's release
h.FormatVersion = version('-release');

% Generate the required tools based on the inputs
h.generateRequiredTools();
    function out = parseInputArgs(params)
        numArgs = numel( params );
        if mod( numArgs, 2 )~=0
            error( message( 'coder_compile:toolchain:InvalidToolchainInfoParamValueSize' ) );
        end
        p = inputParser;
        p.FunctionName = 'ToolchainInfo';
        p.addParameter( 'SupportedLanguages', { 'C/C++' } );
        p.addParameter( 'BuildArtifact', 'gmake makefile' );
        p.addParameter( 'BuildArtifactWriter', [  ] );
        p.addParameter( 'BuildArtifactExecutor', [  ] );
        p.addParameter( 'InitOnly', false );
        % Others
        p.addParameter( 'Name', '' );
        p.addParameter( 'SupportedVersion', '' );
        p.addParameter( 'Revision', '1.0' );
        p.addParameter( 'Platform', computer( 'arch' ) );
        if numArgs>0
            paramNames = params( 1:2:end );
            idx = find( ~ismember( paramNames, p.Parameters ) );
            if ~isempty( idx )
                error( message( 'coder_compile:toolchain:InvalidToolchainInfoParam', coder.make.internal.cell2str( paramNames( idx ), ',' ) ) );
            end
        end
        try
            p.parse( params{ : } );
        catch exc
            error( message( 'coder_compile:toolchain:ToolchainInfoParamParseProblem', exc.message ) );
        end
        out = p.Results;
    end
end
