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

MPIR_HOME   = @MPIR_HOME@
CC          = @MPICC@
CLINKER     = @MPICC@
CCC         = @MPICPLUSPLUS@
CCLINKER    = $(CCC)
F77         = @MPIF77@
FLINKER     = @MPIF77@
OPTFLAGS    = @OPTFLAGS@

### End User configurable options ###

SHELL = /bin/sh

PROFLIB =
CFLAGS  = $(OPTFLAGS) 
CCFLAGS = $(CFLAGS)
FFLAGS = $(OPTFLAGS)
# Use LIBS to add any special libraries for C programs
LIBS = 
# Use FLIBS to add any special libraries for Fortran programs
FLIBS = 
EXECS = timers baseattr errhand sigchk timertest init

default: $(EXECS)

#
# Note that runtests builds the executables as required
testing: $(MPIR_HOME)/util/mpirun
	-./runtests $(TESTARGS)

linktest: default clean

all: testing

init: init.o
	$(CLINKER) $(OPTFLAGS) -o init init.o $(LIBS)
timers: timers.o test.o
	$(CLINKER) $(OPTFLAGS) -o timers timers.o test.o $(LIBS)
timertest: timertest.o test.o
	$(CLINKER) $(OPTFLAGS) -o timertest timertest.o test.o $(LIBS)
baseattr: baseattr.o test.o
	$(CLINKER) $(OPTFLAGS) -o baseattr baseattr.o test.o $(LIBS)
baseattrf: baseattrf.o
	$(FLINKER) $(OPTFLAGS) -o baseattrf baseattrf.o $(LIBS)
errhand: errhand.o test.o
	$(CLINKER) $(OPTFLAGS) -o errhand errhand.o test.o $(LIBS)
sigchk: sigchk.o test.o
	$(CLINKER) $(OPTFLAGS) -o sigchk sigchk.o test.o $(LIBS)
clean:
	/bin/rm -f *.o *~ PI* $(EXECS) baseattrf core *.out *.orig env.diff \
	argstest

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

# MPICH specific
#$(MPIR_HOME)/util/mpirun:
#	(cd $(MPIR_HOME) ; make mpirun )
