ALL: default

# This is a special Makefile.in source for use by the test suite (see the
# configure in examples/test)
##### User configurable options #####

MPIR_HOME    = @MPIR_HOME@
CC           = @MPICC@
CLINKER      = @MPICC@
CCC          = @MPICPLUSPLUS@
CCLINKER     = $(CCC)
F77          = @MPIF77@
F90BASE	     = @MPIF90BASE@
F90          = @MPIF90@
FLINKER      = @MPIF77@
OPTFLAGS     = @OPTFLAGS@
MPIFDEP      = @MPIFDEP@
### End User configurable options ###

SHELL = /bin/sh
prefix     = @prefix@
top_srcdir = @top_srcdir@
srcdir     = @srcdir@
@VPATH@

PROFLIB =
CFLAGS  = @CFLAGS@ @DEFS@ $(OPTFLAGS) 
CCFLAGS = $(CFLAGS)
FFLAGS = $(OPTFLAGS) @FFLAGS@
# Use LIBS to add any special libraries for C programs
LIBS = @LIB_PATH@ @LIB_LIST@
# Use FLIBS to add any special libraries for Fortran programs
FLIBS = @FLIB_PATH@ @LIB_LIST@ @F77EXTRALIBS@
EXECS = $(CTESTS) $(FTESTS)
OTHEREXECS = 
CTESTS = simple perf async coll_test coll_perf misc file_info excl \
       large_array \
     atomicity noncontig i_noncontig noncontig_coll split_coll shared_fp \
     large_file psimple error status noncontig_coll2
FTESTS = fcoll_test fperf fmisc pfcoll_test 

default: $(EXECS)

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

all: testing

fortran_tests: $(FTESTS)
#
# The Fortran tests must be built with the Fortran linker
fperf: fperf.f
	$(F77) $(USER_FFLAGS) -o  $@ $< $(FLIBS)

# Some of the Fortran tests must be derived, so their code will be in the
# LOCAL directory
fcoll_test: fcoll_test.f
	$(F77) $(USER_FFLAGS) -o  fcoll_test fcoll_test.f $(FLIBS)

fmisc: fmisc.f
	$(F77) $(USER_FFLAGS) -o  fmisc fmisc.f $(FLIBS)

pfcoll_test: pfcoll_test.f	
	$(F77) $(USER_FFLAGS) -o  pfcoll_test pfcoll_test.f $(FLIBS)

#
# Make sure that we remove executables for specific architectures
clean:
	@-rm -f *.o *~ PI* $(EXECS) *.out core pt2pt.diff $(OTHEREXECS) \
		*.trace rdb.* startup.* mpif.h ${srcdir}/*.o *.stdo
	@-rm -f work.pc work.pcl
	@-for file in $(EXECS) Makefile ; do \
	   rm -f $$file.sun4 $$file.alpha $$file.IRIX $$file.freebsd ;\
	done
.c:
	$(CC) $(CFLAGS) -o $* $< $(LIBS)
.c.o:
	$(CC) $(CFLAGS) -c $<
.o:
	${CLINKER} $(OPTFLAGS) -o $* $*.o $(LIBS)
.f.o:
	$(F77) $(FFLAGS) -c $<
