#makefile.matlab build file
# Edited Dec. 11, 2002 rcg
#   If this build file is executed standalone without the build-env file
#	  executed first, then define CC as follows:
#	  Solaris: setenv CC "/opt/SUNWspro/bin/cc -DSOL -DSVR4 -lnsl -lsocket"
#	  Linus: setenv CC "cc"
#	CFLAGS can be empty.
#   Change call to mex, not cmex.  rcg Dec. 11, 2002
#   Change location of cmex from data2/opt/matlab/bin
#	to /data13/opt/matlab61/bin.  Remove mc, bs and 
#	../methods/browserfrom all:.   rcg Dec. 9, 2002

# Edited first (& only) three occurrances of cc to be ${CC} 7/22/1998 rcg

all:  \
  buildmat \
  loadjg.cmex \
  jgbrowser.m \
  dirjg.m

#mc:mc.c
#	${CC} ${CFLAGS} mc.c ../lib/jgofs.a -o $@

#bs:bs.c
#	${CC} ${CFLAGS} bs.c ../lib/jgofs.a -o $@

#../methods/browser: browser.c
#	${CC} ${CFLAGS} ../methodssrc/outer.o browser.c -o $@

jgbrowser.m:jgbrowser.m.tmp
	sed "s*jgofsdir*${JGOFSDIR}*" jgbrowser.m.tmp > jgbrowser.m

dirjg.m:dirjg.m.tmp
	sed "s*jgofsdir*${JGOFSDIR}*" dirjg.m.tmp | sed "s*infoserver*${INFOSERVER}*" > dirjg.m

buildmat:buildmat.c
	${CC} ${CFLAGS} buildmat.c ../lib/jgofs.a -lm -o $@

loadjg.cmex:loadjg.c startchild.c geturl.c
	/data13/opt/matlab61/bin/mex -D${SYS} loadjg.c startchild.c geturl.c;touch loadjg.cmex;cat matlabnotes

loadjg.c:loadjg.csrc
	sed 's*BUILDMAT*"${JGOFSDIR}/src/matlab/buildmat "*' loadjg.csrc > loadjg.c

