ALL: default
##### User configurable options #####

SHELL = /bin/sh
ARCH        = @ARCH@
COMM        = @COMM@
MPIR_HOME   = @MPIR_HOME@
CC          = @MPIR_HOME@/lib/@ARCH@/@COMM@/mpicc
CLINKER     = $(CC)
CCC         = @MPIR_HOME@/lib/@ARCH@/@COMM@/mpiCC
CCLINKER    = $(CCC)
F77         = @MPIR_HOME@/lib/@ARCH@/@COMM@/mpif77
FLINKER     = $(F77)
PROFILING   = $(PMPILIB)
OPTFLAGS    = @OPTFLAGS@

### End User configurable options ###

PROFLIB = 
CFLAGS  = $(OPTFLAGS)
CCFLAGS = $(CFLAGS)
FFLAGS = $(OPTFLAGS)
LIBS = $(PROFLIB) -lm
LIBSPP = $(MPIPPLIB) $(LIBS)
EXECS = mpptest goptest vectest stress ctest cluster

default: $(EXECS)

OBJS = gopf.o grph.o ovlap.o pair.o pattern.o util.o getopts.o \
	tstauto.o rate.o mpe_seq.o copy.o

mpptest: mpptest.o $(OBJS)
	$(CLINKER) $(OPTFLAGS) -o mpptest mpptest.o $(OBJS) $(LIBS)

goptest: goptest.o $(OBJS)
	$(CLINKER) $(OPTFLAGS) -o goptest goptest.o $(OBJS) $(LIBS)

copytest: copytest.o
	$(CLINKER) $(OPTFLAGS) -o copytest copytest.o $(LIBS)

stress: stress.o daytime.o getopts.o
	$(CLINKER) $(OPTFLAGS) -o stress stress.o daytime.o \
		getopts.o $(LIBS)

tunepkt: tunepkt.o
	$(CLINKER) $(OPTFLAGS) -o tunepkt tunepkt.o $(LIBS)

pktuse: pktuse.o
	$(CLINKER) $(OPTFLAGS) -o pktuse pktuse.o $(LIBS)

ctest: ctest.o
	$(CLINKER) $(OPTFLAGS) -o ctest ctest.o $(LIBS)

cluster: cluster.o
	$(CLINKER) $(OPTFLAGS) -o cluster cluster.o $(LIBS)

vectest: mpif.h vectest.o
	$(FLINKER) $(OPTFLAGS) -o vectest vectest.o 

clean:
	/bin/rm -f *.o *~ $(EXECS) tunepkt pktuse core TAGS .foo *.gpl \
	           *.log gop.ps *.gpl *.gcm makeplot info.txt basetest.tar \
	           copytest

.c.o:
	$(CC) $(CFLAGS) -c $*.c
.f.o:
	$(F77) $(FFLAGS) -c $*.f

mpif.h:
	ln -s $(MPIR_HOME)/include/mpif.h mpif.h
