ALL: default

##### User configurable options #####
# This is an example Makefile.in (or Makefile configured with mpireconfig)

ARCH        = @ARCH@
COMM        = @COMM@
#INSTALL_DIR = @INSTALL_DIR@
INSTALL_DIR = @MPIR_HOME@
CC          = @CC@
F77         = @F77@
CLINKER     = @CLINKER@
FLINKER     = @FLINKER@
OPTFLAGS    = @OPTFLAGS@
#
LIB_PATH    = -L$(INSTALL_DIR)/lib/$(ARCH)/$(COMM)
FLIB_PATH   = @FLIB_PATH_LEADER@$(INSTALL_DIR)/lib/$(ARCH)/$(COMM)
LIB_LIST    = @LIB_LIST@
#
INCLUDE_DIR = @INCLUDE_PATH@ -I$(INSTALL_DIR)/include

### End User configurable options ###

CFLAGS  = @CFLAGS@ $(OPTFLAGS) $(INCLUDE_DIR) -DMPI_$(ARCH)
FFLAGS = @FFLAGS@ $(INCLUDE_DIR) $(OPTFLAGS)
LIBS = $(LIB_PATH) $(LIB_LIST)
FLIBS = $(FLIB_PATH) $(LIB_LIST)

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

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

EXECS =  attr commdup commfree compare intercomm split
default: $(EXECS)

attr: attr.o
	$(CLINKER) $(OPTFLAGS) -o attr attr.o \
	$(LIB_PATH) $(LIB_LIST) -lm
commdup: commdup.o
	$(CLINKER) $(OPTFLAGS) -o commdup commdup.o \
	$(LIB_PATH) $(LIB_LIST) -lm
commfree: commfree.o
	$(CLINKER) $(OPTFLAGS) -o commfree commfree.o \
	$(LIB_PATH) $(LIB_LIST) -lm
compare: compare.o
	$(CLINKER) $(OPTFLAGS) -o compare compare.o \
	$(LIB_PATH) $(LIB_LIST) -lm
intercomm: intercomm.o
	$(CLINKER) $(OPTFLAGS) -o intercomm intercomm.o \
	$(LIB_PATH) $(LIB_LIST) -lm
split: split.o
	$(CLINKER) $(OPTFLAGS) -o split split.o \
	$(LIB_PATH) $(LIB_LIST) -lm
testing: $(EXECS)
	mpirun -np 2 attr
	mpirun -np 2 commdup
	mpirun -np 2 commfree
	mpirun -np 2 compare
	mpirun -np 2 intercomm
	mpirun -np 2 split
