SHELL=/bin/sh
CFLAGS	= -I. -O3 
MPICC=mpicc
BSPCC=bspcc
MPIFLAGS =  -lm -O3
BSPBT=bspbt
MPIBT=mpibt
#BT=bt
#BT=gbt
#BT=bt
BT=gtt
EXT=1
#BSPFLAGS = -O3  -flibrary-level 2   -fcombine-puts  \
            -bspnoslots 1 -bspslotsize  40 \
            -bsproundtrip 200 -bspsendlatency 25 
#Former for small n, latter for 1024 or more
#25, 200,25
#25,180,25L ,100noslot for big prob size and 16procs
#25,180,25L ,1noslot   for big prob size and 4procs
BSPFLAGS =  -flibrary-level 2  -bspnoslots ${EXT}\
           -bspslotsize  25  -bsproundtrip 180\
           -bspsendlatency 25  -lm
BSPFLAGS =  -flibrary-level 2  -bspnoslots ${EXT}\
           -bspslotsize 25  -bsproundtrip 180\
           -bspsendlatency 25  -lm
allbsp	:	${BSPBT}
allmpi	:	${MPIBT}
bspbt	:	${BT}main.o ${BT}.o 
	${BSPCC} ${BSPFLAGS} ${BT}main.o ${BT}.o -o bsp${BT}${EXT}
	strip   bsp${BT}${EXT}
	ccp bsp${BT}${EXT} run
mpibt	:	m${BT}main.o m${BT}.o  aimpi.o
	${MPICC} ${MPIFLAGS} ${BT}main.o ${BT}.o aimpi.o -o mpi${BT}
	strip   mpi${BT}
	ccp mpi${BT} run
#
btmain.o:	btmain.c
	${BSPCC} ${CFLAGS} -c  btmain.c
mbtmain.o:	btmain.c
	${MPICC} ${CFLAGS} -c  btmain.c
gbtmain.o:	gbtmain.c
	${BSPCC} ${CFLAGS} -c  gbtmain.c
mgbtmain.o:	gbtmain.c
	${MPICC} ${CFLAGS} -c  gbtmain.c
gttmain.o:	gttmain.c
	${BSPCC} ${CFLAGS} -c  gttmain.c
mgttmain.o:	gttmain.c
	${MPICC} ${CFLAGS} -c  gttmain.c
#
bt.o:	bt.c
	${BSPCC} ${CFLAGS} -c  bt.c
mbt.o:	bt.c
	${MPICC} ${CFLAGS} -c  bt.c
#
gbt.o:	gbt.c
	${BSPCC} ${CFLAGS} -c  gbt.c
mgbt.o:	gbt.c
	${MPICC} ${CFLAGS} -c  gbt.c
#
gtt.o:	gtt.c
	${BSPCC} ${CFLAGS} -c  gtt.c
mgtt.o:	gtt.c
	${MPICC} ${CFLAGS} -c  gtt.c
#
aimpi.o:	aimpi.c
	${MPICC} ${CFLAGS} -c aimpi.c -o aimpi.o
clean:
	rm -f *.o bspbt mpibt   bspgbt mpigbt bspgtt mpigtt
tar:
	tar cvf bt02.tar ai.h aimpi.h bt.h Makefile \
		bt.c btmain.c btread.rdm gbt.c gbtmain.c \
		gtt.c gttmain.c data mdata gdata
ttar:
	tar cvf tt02.tar ai.h aimpi.h aimpi.c bt.h Makefile \
		gtt.c gttmain.c gtread.rdm tdata copy\
		Seq/Makefile Seq/tdata Seq/tdata3 Seq/tdata2 \
		Seq/tomain.c Seq/toption.c Seq/tdata.rdm Seq/option.h
