function make_mex_file;
% Makefile for Linux

cd tools/mex_linuxpc

if (exist('out_mex') ~= 3),
        cd ../../src
	mex -c ts_tools.c
	mex out_mex.c ts_tools.o
	mex jacob_inputs.c ts_tools.o
	mex jacob_params.c ts_tools.o
    	mex -O ICmain.c ICclasses.c -o ICctrl.mexlx
    	mex -O simulation_error.c ICclasses.c -o simulate.mexlx
	mex lookup_out.c
	mex lookup_jac.c
        !mv *.mexlx ../tools/mex_linuxpc/
        cd ../tools/mex_linuxpc
end

if (exist('clqLL') ~= 3),
        cd ../../src
	mex -O clqLL.c
        !mv *.mexlx ../tools/mex_linuxpc/
        cd ../tools/mex_linuxpc
end

cd ../..

