function [objectFileList, sourceFileList] = code_machine_objlist_file(fileNameInfo,buildInfo,ext)

% [OBJECTFILELIST, SOURCEFILELIST] = CODE_MACHINE_OBJLIST_FILE(FILENAMEINFO,BUILDINFO,EXT)

%   Copyright 1995-2018 The MathWorks, Inc.
    
    if (nargin < 3)
        ext = '.obj';
    end

    fileName = fullfile(fileNameInfo.targetDirName,fileNameInfo.objListFile);
    sf_echo_generating('Coder',fileName);
    file = fopen(fileName,'Wt');
    if file<3
        construct_coder_error([],sprintf('Failed to create file: %s.',fileName),1);
    end


    sourceFileList = buildInfo.getSourceFiles(true,true);
    objectFileList = cell(1, numel(sourceFileList));

    for i = 1:numel(sourceFileList)
        thisSourceFile = sourceFileList{i};
        [~,nameStr] = fileparts(thisSourceFile); 
        thisObjFile = [nameStr, ext];
fprintf(file,'%s\n',thisObjFile);
        objectFileList{i} = thisObjFile;
    end

    fclose(file);
