#!/bin/sh
USAGE="usage=$0 <name_of_c_file1> ... <name_of_c_fileN>"

# This is a Bourne Shell script that builds MATLAB "external applications."
#from input C source code files.

# Edit the definition of MATLABROOT to specify the pathname of the top-level 
# directory on which the MATLAB libraries are installed. 

#MATLABROOT=/usr/local/matlab
MATLABROOT=/tmp_mnt/export/home/c0t0d0s6/misc/matlabph/matlab-4.2c



# Edit the definition of ARCH to specify the flavor of UNIX 
# on which you are building.  Possible values for ARCH are:
#   * alpha
#   * hp700
#   * ibm_rs
#   * sgi
#   * sol2
#   * sun4

#sun 4
ARCH=sun4
CC=gcc
CPPFLAGS=-Dsparc
CFLAGS="-O -ansi"
SYSLIBS=-lm

#sol2
#ARCH=sol2
#CC=cc
#CPPFLAGS=
#CFLAGS="-O -Xa -xlibmieee -xlibmil"
#SYSLIBS=-lm

#hp700
ARCH=hp700
CC=cc
CPPFLAGS="-Aa -D_HPUX_SOURCE"
CFLAGS=-O
SYSLIBS=-lm

#sgi
#ARCH=sgi
#CC=cc
#CPPFLAGS=
#CFLAGS=-O
#SYSLIBS="-lblas -lm"

#ibm_rs
#ARCH=ibm_rs
#CC=cc
#CPPFLAGS="-qlanglvl=ansi -D_ALL_SOURCE"
#CFLAGS="-O -qfloat=nomaf"
#SYSLIBS=-lm

#alpha
#ARCH=alpha
#CC=cc
#CPPFLAGS=-std1
#CFLAGS="-O -ieee_with_no_inexact -assume noaccuracy_sensitive"
#SYSLIBS="-lots -lm"

# List of libraries to link against.
INSTALLDIR=$MATLABROOT/extern  
LIBDIR=$INSTALLDIR/lib/$ARCH
MATLAB_TOOLBOX_LIBRARY=$LIBDIR/libtbx.a
MATLAB_COMPILER_LIBRARY=$LIBDIR/libmcc.a
MATLAB_MATH_LIBRARY=$LIBDIR/libmatlb.a
MATLAB_INCLUDE_DIRECTORY=$INSTALLDIR/include

# Edit the definition of TARGET_APPLICATION to specify the name
# of the resulting external application.
TARGET_APPLICATION=a.out

# Compile and link.
$CC -o $TARGET_APPLICATION -I$MATLAB_INCLUDE_DIRECTORY $CPPFLAGS $CFLAGS $* \
                   $MATLAB_TOOLBOX_LIBRARY  \
                   $MATLAB_COMPILER_LIBRARY \
                   $MATLAB_MATH_LIBRARY     \
                   $SYSLIBS


