function make_mex_file;
% Makeile for Windowz

cd tools/mex_winthell

if (exist('out_mex') ~= 3),
        cd ../../src
	mex -c ts_tools.c
	mex out_mex.c ts_tools.obj
	mex jacob_inputs.c ts_tools.obj
	mex jacob_params.c ts_tools.obj
        mex -O ICmain.c ICclasses.c
        !ren ICmain.dll ICctrl.dll 
        mex -O simulation_error.c ICclasses.c 
        !ren simulation_error.dll simulate.dll
	mex lookup_out.c
	mex lookup_jac.c
	!move *.dll ..\tools\mex_winthell
	cd ../tools/mex_winthell
end

if (exist('clqLL') ~= 3),
        cd ../../src
	mex -O clqLL.c
	!move *.dll ..\tools\mex_winthell
        cd ../tools/mex_winthell
end

cd ../..

