gusucode.com > private工具箱matlab源码程序 > private/code_append_libs_to_objlist_file_unix.m

    function libList = code_append_libs_to_objlist_file_unix(objListFile, targetDirName , ...
    buildInfo, group, excludeGroups)
% [LIBLIST] = CODE_APPEND_LIBS_TO_OBJLIST_FILE_UNIX(FILENAMEINFO, BUILDINFO, GROUP)
% group can be either 'LINK_MACHINE_LIBS' or 'TMWLIB'

%   Copyright 2014-2015 The MathWorks, Inc.


    if nargin < 5
        excludeGroups = {};
    end
    fileName = fullfile(targetDirName,objListFile);
    file = fopen(fileName,'At');
    if file<3
        construct_coder_error([],sprintf('Failed to create file: %s.',fileName),1);
    end
    
    % Add LINK_MACHINE_LIBS into OBJFILE_LIST due to g1205457
    linkObjs = buildInfo.getLinkObjects(group,excludeGroups);
    libList = cell(1, numel(linkObjs));
    for i = 1:numel(linkObjs)
        currLinkObjPath = strrep(linkObjs(i).Path,'$(MATLAB_ROOT)',matlabroot);
        fullfileName = fullfile(currLinkObjPath,linkObjs(i).Name);
        if isequal(group, 'LINK_MACHINE_OBJLIST') 
            linkObjStr = fileread(fullfileName); 
            linkObjStr = regexprep(linkObjStr, '[\n\r]+',sprintf('\n'));
        elseif any(ismember(group,{'SFCLIB','USER_LIBS','LINK_MACHINE_LIBS', ...
            'AUX_LNK_OBJS'})) || isempty(group)
            %Third Party Library have empty group
            linkObjStr = ['"' fullfileName '"'];
        else
            linkObjStr = ['"-L' currLinkObjPath '" "-l' linkObjs(i).Name '"'];
        end

fprintf(file,'%s\n',linkObjStr);
        
        libList{i} = linkObjStr;
    end   

    fclose(file);