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 =  abort err errstr final init initialized pcontrol procname wtime
default: $(EXECS)

abort: abort.o
	$(CLINKER) $(OPTFLAGS) -o abort abort.o \
	$(LIB_PATH) $(LIB_LIST) -lm
err: err.o
	$(CLINKER) $(OPTFLAGS) -o err err.o \
	$(LIB_PATH) $(LIB_LIST) -lm
errstr: errstr.o
	$(CLINKER) $(OPTFLAGS) -o errstr errstr.o \
	$(LIB_PATH) $(LIB_LIST) -lm
final: final.o
	$(CLINKER) $(OPTFLAGS) -o final final.o \
	$(LIB_PATH) $(LIB_LIST) -lm
init: init.o
	$(CLINKER) $(OPTFLAGS) -o init init.o \
	$(LIB_PATH) $(LIB_LIST) -lm
initialized: initialized.o
	$(CLINKER) $(OPTFLAGS) -o initialized initialized.o \
	$(LIB_PATH) $(LIB_LIST) -lm
pcontrol: pcontrol.o
	$(CLINKER) $(OPTFLAGS) -o pcontrol pcontrol.o \
	$(LIB_PATH) $(LIB_LIST) -lm
procname: procname.o
	$(CLINKER) $(OPTFLAGS) -o procname procname.o \
	$(LIB_PATH) $(LIB_LIST) -lm
wtime: wtime.o
	$(CLINKER) $(OPTFLAGS) -o wtime wtime.o \
	$(LIB_PATH) $(LIB_LIST) -lm
testing: $(EXECS)
	mpirun -np 2 abort
	mpirun -np 1 err
	mpirun -np 2 errstr
	mpirun -np 2 final
	mpirun -np 2 ./init
	mpirun -np 2 initialized
	mpirun -np 2 pcontrol
	mpirun -np 2 procname
	mpirun -np 2 wtime
