#!/bin/sh
#
#  Specify the MATLAB root directory and the directory
#  where SDPT3-3.1/Solver/mexexec is residing 
#
   MATLAB="/usr/local/matlabr12"
   MEXEXECDIR=$HOME/SDPT3-3.0/Solver/mexexec
#
#--------------------------------------------------------------
# Normally, you do not have to make any change below this line.
#--------------------------------------------------------------
if [ ! -d $MATLAB/extern ]; then
   echo "Install: cannot find matlab API directory"
   exit 1
fi

#
# Install the C mex files
#
if [ $# -eq 0 -o "$1" = "mex" ]; then

   if [ -f $MATLAB/bin/mex ]; then
	MEX="$MATLAB/bin/mex"
   else
        echo "Install: cannot find mex"
        exit
   fi
#
   MEXFLAGS=-O 
#
   $MEX $MEXFLAGS  mexProd2.c  
   $MEX $MEXFLAGS  mexProd2nz.c  
   $MEX $MEXFLAGS  mexinprod.c  
   $MEX $MEXFLAGS  mexmat.c  
   $MEX $MEXFLAGS  mexsmat.c  
   $MEX $MEXFLAGS  mexsvec.c
   $MEX $MEXFLAGS  mexschur.c 
   $MEX $MEXFLAGS  mexbsolve.c    
   $MEX $MEXFLAGS  mexchol.c    
   $MEX $MEXFLAGS  mexqops.c  
   $MEX $MEXFLAGS  mexqprod.c  

   $MEX $MEXFLAGS  ordmmd.c  ordmmdg.c
   $MEX $MEXFLAGS  symfct.c  symfctg.c
   $MEX $MEXFLAGS  inpnv.c   inpnvg.c
   $MEX $MEXFLAGS  blkfct.c  blkfctg.c
   $MEX $MEXFLAGS  blkslv.c  blkslvg.c

   /bin/mv -f *.mex* $MEXEXECDIR/ 
fi



