function code_interface_and_support_files(fileNameInfo)

%   Copyright 1995-2021 The MathWorks, Inc.

    global gTargetInfo gMachineInfo %#ok<GVMIS>

    if gTargetInfo.codingDllTargetForSLTest
       if(ispc)
           if(gTargetInfo.codingSLRT)
               code_slrealtime_qnx_make_file_for_dll_target(fileNameInfo);
           else
               code_msvc_make_file_for_dll_target(fileNameInfo);
           end
       elseif(isunix)
           code_unix_make_file_for_dll_target(fileNameInfo);
       end
       return;
    end
    if(~gTargetInfo.codingSFunction)
      return;
    end
    % Generate the interface files only when there are no codegen errors
     msgString = ['\n' getString(message('Stateflow:sfprivate:InterfaceAndSupport')) '\n'];
     sfprivate('sf_display',msgString);

    if(~gTargetInfo.codingLibrary)
        machineInfo.machineName = gMachineInfo.machineName;
        machineInfo.fileName = fullfile(fileNameInfo.targetDirName, fileNameInfo.machineRegistryFile);
        machineInfo.linkMachines = fileNameInfo.linkMachines;
        machineInfo.machineHeaderFile = fileNameInfo.machineHeaderFile;

        machineInfo.codingExtMode = gTargetInfo.codingExtMode;
        machineInfo.codingDebug = gTargetInfo.codingDebug;
        machineInfo.codingSFunction= gTargetInfo.codingSFunction;
        machineInfo.gencpp = gTargetInfo.gencpp;
        machineInfo.codingCoverage = ~gTargetInfo.codingGPU;
        
        sf_echo_generating('Coder',machineInfo.fileName);
        sf('Cg', 'dump_code_machine_registry_file', machineInfo );
        try_indenting_file(machineInfo.fileName);
    end
                           
     code_rtwtypesdoth(fileNameInfo);
     assert(isfield(fileNameInfo, 'buildInfo'));
     buildInfo = fileNameInfo.buildInfo;
     if gTargetInfo.codingMSVCMakefile
         code_msvc_make_file(fileNameInfo,buildInfo,gMachineInfo.machineName);
     end

     if sf('Feature','Developer') && ispc
         code_msvc_vcproj_file(fileNameInfo);
     end
     if gTargetInfo.codingUnixMakefile
         code_unix_make_file(fileNameInfo,buildInfo,gMachineInfo.machineName);
     end
     if gTargetInfo.codingMinGWMakefile
         CGXE.Coder.code_mingw_make_file(fileNameInfo, buildInfo, ...
             gMachineInfo.machineName, gMachineInfo.targetName, ...
             gTargetInfo);
     end

     if (~isunix && gTargetInfo.codingLccMakefile && ...
         ~gTargetInfo.codingMSVCMakefile)
             code_lcc_make_file(fileNameInfo,buildInfo,gMachineInfo.machineName);
     end

    sfprivate('sf_display',newline);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function code_rtwtypesdoth(fileNameInfo)
global gTargetInfo gMachineInfo %#ok<GVMIS>

hardwareImp = rtwhostwordlengths();
hardwareImpProps = rtw_host_implementation_props();
fNames = fieldnames(hardwareImpProps);
for i=1:length(fNames)
    hardwareImp.(fNames{i}) = hardwareImpProps.(fNames{i});
end
hardwareImp.HWDeviceType = 'Generic->MATLAB Host Computer';
        
hardwareDeploy = [];
hardwareDeploy.CharNumBits      = get_param(gMachineInfo.mainMachineName, 'ProdBitPerChar');
hardwareDeploy.ShortNumBits     = get_param(gMachineInfo.mainMachineName, 'ProdBitPerShort');
hardwareDeploy.IntNumBits       = get_param(gMachineInfo.mainMachineName, 'ProdBitPerInt');
hardwareDeploy.LongNumBits      = get_param(gMachineInfo.mainMachineName, 'ProdBitPerLong');
hardwareDeploy.LongLongNumBits  = get_param(gMachineInfo.mainMachineName, 'ProdBitPerLongLong');
hardwareDeploy.LongLongMode     = int32(strcmp(get_param(gMachineInfo.mainMachineName, 'ProdLongLongMode'), 'on'));
hardwareDeploy.FloatNumBits     = hardwareImp.FloatNumBits;
hardwareDeploy.DoubleNumBits    = hardwareImp.DoubleNumBits;
hardwareDeploy.PointerNumBits   = hardwareImp.PointerNumBits;
        
configInfo = [];
configInfo.GenDirectory = fileNameInfo.targetDirName;
configInfo.PurelyIntegerCode = gTargetInfo.codingIntegerCodeOnly;
configInfo.SupportComplex = ~gTargetInfo.codingRealCodeOnly;
configInfo.MaxMultiwordBits = 1024;

% Uncomment to support complex type alignment in stateflow
% configInfo.ModelName = gMachineInfo.mainMachineName;
       
simulinkInfo = coder.internal.getCoderTypesSimulinkInfo...
('Style', 'full', 'IsERT', false);
        
ansiDataTypeName = genRTWTYPESDOTH(hardwareImp,hardwareDeploy,configInfo,simulinkInfo);
assert(ansiDataTypeName.multiword_types);
if sf('feature','Half_MLFB')
    genHALFTYPEHDR(gMachineInfo.mainMachineName,configInfo,simulinkInfo,gMachineInfo.parentTarget);
    [~, HalfFileName] = genHALFTYPESRC(gMachineInfo.mainMachineName,configInfo,simulinkInfo,gMachineInfo.parentTarget);
    fileNameInfo.buildInfo.addSourceFiles(HalfFileName,fileNameInfo.targetDirName,'MODULE_SRCS');
end


