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

ARCH        = @ARCH@
COMM        = @COMM@
BOPT        = @BOPT@
P4_DIR      = @P4_DIR@
TOOLS_DIR   = @TOOLS_DIR@
MPIR_HOME   = @MPIR_HOME@
CC          = @CC@
CLINKER     = $(CC)
CCC         = @CPP_COMPILER@
CCLINKER    = $(CCC)
F77         = @F77@
FLINKER     = $(F77)
AR          = @AR@
RANLIB      = @RANLIB@
PROFILING   = $(PMPILIB)
OPTFLAGS    = @OPTFLAGS@
MPE_LIBS    = @MPE_LIBS@
MPE_DIR     = @MPE_DIR@
LIB_PATH    = @LIB_PATH@
FLIB_PATH   = @FLIB_PATH@
LIB_LIST    = @LIB_LIST@
MPE_GRAPH   = @MPE_GRAPHICS@
#
INCLUDE_DIR = @USER_INCLUDE_PATH@ -I$(MPIR_HOME)/include -I$(MPE_DIR)
DEVICE      = @DEVICE@

### End User configurable options ###

CFLAGS  = @USER_CFLAGS@ $(OPTFLAGS) $(INCLUDE_DIR) -DMPI_$(ARCH) $(MPE_GRAPH)
CCFLAGS = $(CFLAGS)
#FFLAGS = '-qdpc=e' 
FFLAGS = @FFLAGS@ $(OPTFLAGS)
MPILIB = $(MPIR_HOME)/lib/$(ARCH)/$(COMM)/libmpi.a 
MPIPPLIB = $(MPIR_HOME)/lib/$(ARCH)/$(COMM)/libmpi++.a
LIBS = $(LIB_PATH) $(LIB_LIST)
FLIBS = $(FLIB_PATH) $(LIB_LIST)
LIBSPP = $(MPIPPLIB) $(LIBS)
EXECS = pi pi2 pi3 cpilog cpi matmult monte
default: $(EXECS)

all: default

cpi: cpi.o $(MPIR_HOME)/include/mpir.h $(MPILIB)
	$(CLINKER) $(OPTFLAGS) -o cpi cpi.o \
	$(LIB_PATH) ${MPE_LIBS} $(LIB_LIST) -lm

cpilog: cpilog.o $(MPIR_HOME)/include/mpir.h $(MPILIB)
	$(CLINKER) $(OPTFLAGS) -o cpilog cpilog.o \
	$(LIB_PATH) ${MPE_LIBS} $(LIB_LIST) -lm

monte: monte.o $(MPIR_HOME)/include/mpif.h
	$(CLINKER) $(OPTFLAGS) -o monte monte.o \
	$(LIB_PATH) ${MPE_LIBS} $(LIB_LIST) -lm

pi: pi.o $(MPIR_HOME)/include/mpif.h
	$(FLINKER) $(OPTFLAGS) -o pi pi.o $(FLIBS)

pi2: pi2.o $(MPIR_HOME)/include/mpif.h
	$(FLINKER) $(OPTFLAGS) -o pi2 pi2.o $(FLIBS)

pi3: pi3.o $(MPIR_HOME)/include/mpif.h
	$(FLINKER) $(OPTFLAGS) -o pi3 pi3.o $(FLIBS)

matmult: matmult.o $(MPIR_HOME)/include/mpif.h
	$(FLINKER) $(OPTFLAGS) -o matmult matmult.o $(FLIBS)

clean:
	/bin/rm -f *.o *~ PI* $(EXECS)

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

