
mc;


rootdir = 'C:\LTPDA';
toolboxDir = fullfile(rootdir, sprintf('ltpda_toolbox'), 'ltpda');
toolboxRoot = fullfile(rootdir, 'ltpda_toolbox');

ltpda_ver       = '1.0.1'; % this is the version for the Contents.m and for packaging
mver      = ver('MATLAB');
ltpda_version = sprintf('%s %s %s', ltpda_ver, mver.Release, datestr(now, 'dd-mm-yy'));


makeDoc = 0;

cdir = pwd;
cd(toolboxDir);
MakeContents('LTPDA', ltpda_version);
cd(cdir);

if makeDoc
  % Build doc list
  docs = [];
  for j=1:length(classes)
    docs = [docs cellstr(['classes/@' classes{j}])];
  end
  for j=1:length(srcs)
    if ~strcmp(srcs{j}, 'mex')
      docs = [docs cellstr(srcs{j})];
    end
  end

  % build documentation
  m2html('mfiles', docs,...
    'htmldir', 'html_help/help/ug',...
    'recursive', 'on',...
    'template', 'docstyle',...
    'indexFile', 'mindex');
end

% Make on-line html TOC
cd html_help/help
convertTOC

% try to generate html codes
  try
    [temp pythonVer] = system('python --version');
    pythonVer = strtok(pythonVer,'Python ');
    if numel(pythonVer)>3, pythonVer(4:end)=[]; end
    pythonVer = str2double(pythonVer);
    if isnan(pythonVer)
        error('*** Failed check of Python version');
    elseif pythonVer > 2.6
        !python ./mkhelpfiles_v3.py -i helptoc.xml
    else
        !python ./mkhelpfiles.py -i helptoc.xml
    end
  catch
    warning('!!! Couldn''t run mkhelpfiles.py. Do you have python installed?');
  end
cd(cdir)

% Now copy the help files
copyfile('html_help/help', fullfile(toolboxDir,'help'), 'f');
copyfile('html_help/info.xml', toolboxDir, 'f');

