SHELL=/bin/sh
CFLAGS	= -I. -O3 
MPICC=mpicc
BSPCC=bspcc
MPIFLAGS =  -lm -O3
BSPBT=bspfin
MPIBT=mpifin
#BT=gbt
#BT=bt
#BT=gtt
#BT=efdm
BT=bt
#EXT=100
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}
bspfin:	${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
mpifin:	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
efdmmain.o:	efdmmain.c
	${BSPCC} ${CFLAGS} -c  efdmmain.c
mgttmain.o:	gttmain.c
	${MPICC} ${CFLAGS} -c  gttmain.c
mefdmmain.o:	efdmmain.c
	${MPICC} ${CFLAGS} -c  efdmmain.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
efdm.o:	efdm.c
	${BSPCC} ${CFLAGS} -c  efdm.c
mefdm.o:	efdm.c
	${MPICC} ${CFLAGS} -c  efdm.c
#
aimpi.o:	aimpi.c
	${MPICC} ${CFLAGS} -c aimpi.c -o aimpi.o
clean:
	rm -f *.o bspbt mpibt   bspgbt mpigbt bspgtt mpigtt bspefdm mpiefdm aimpi.o
tar:
	tar cvf bt02a.tar ai.h aimpi.h aimpi.c bt.h Makefile \
		bt.c btmain.c btread.rdm gbt.c gbtmain.c \
		gtt.c gttmain.c data bdata gdata mdata README\
		Seq/option.h Seq/Makefile \
                Seq/momain.c Seq/moption.c Seq/gomain.c Seq/goption.c \
                Seq/mdata Seq/gdata Seq/data Seq/data.eg Seq/gdata2\
		Seq/mdata1 Seq/mdata2 Seq/mdata.ori Seq/goption.rdm 
ttar:
	tar cvf tt02a.tar ai.h aimpi.h aimpi.c bt.h Makefile \
		gtt.c gttmain.c gtread.rdm tdata copy README\
		Seq/Makefile Seq/tdata Seq/tdata3 Seq/tdata2 \
		Seq/tomain.c Seq/toption.c Seq/tdata.rdm \
		Seq/option.h
efdmtar:
	tar cvf efdm02.tar ai.h aimpi.c aimpi.h bt.h Makefile \
		efdm.c efdmmain.c efdm.rdm efdata copy README\
		Seq/Makefile Seq/efdata Seq/efdata.rdm  \
		Seq/efmain.c Seq/efoption.c \
		Seq/option.h
efdmtar:
