# This Makefile.in created by simplemake.  Do not edit

# @configure_input@

# --------------------------------------------------------------------------
all: all-redirect

SHELL           = @SHELL@
AR              = @AR@
RANLIB          = @RANLIB@
INSTALL         = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA    = @INSTALL_DATA@
MKDIR_P         = @MKDIR_P@
master_top_srcdir  = @master_top_srcdir@
abs_builddir    = @abs_builddir@
srcdir          = @srcdir@
abs_srcdir      = @abs_srcdir@
prefix          = @prefix@
exec_prefix     = @exec_prefix@
includedir      = @includedir@
libdir          = @libdir@
MAKE            = @MAKE@
MPILIBNAME      = @MPILIBNAME@
PMPILIBNAME     = @PMPILIBNAME@

F90              = @F90@
F90FLAGS        = @F90FLAGS@
F90_COMPILE     = $(F90) $(F90FLAGS) $(F90INCLUDES)

VPATH = .:@srcdir@
MOD              = @F90MODEXT@
MPIMOD           = @MPIMODNAME@
MPICONSTMOD      = @MPICONSTMODNAME@
MPISIZEOFMOD     = @MPISIZEOFMODNAME@
F90INCFLAG       = @F90INCFLAG@
F90EXT           = @F90EXT@
F90_COMPILE_MODS = $(F90_COMPILE) 
F90INCLUDES = @F90INCFLAG@.
doc_sources =

.SUFFIXES:
.SUFFIXES: .o .f90 .o 
.f90.o:
	$(F90_COMPILE) -c $<
.f90:
	$(F90_COMPILE) -o $* $< $(LDFLAGS) $(LIBS)
apply: 
	$(ACTION) $(ACTION_INPUT)
clean:  clean-local
	-@rm -f *.o ${srcdir}/*.o 
	-@rm -f .libstamp0 
	-@rm -f *.lo ${srcdir}/*.lo
distclean:  clean distclean-local distclean-xxx remove-makefile
distclean-xxx:
	-@rm -f Makefile mpi_sizeofs.f90
	-@rm -rf autom4te*.cache
	-@rm -rf $(DEPS_DIR)
	-@rm -f TAGS
remove-makefile:
	rm -f Makefile
remove-genmakefiles:
	rm -f  Makefile
all-redirect: all-preamble lib${MPILIBNAME}f90.a
	${MAKE} all-postamble

lib${MPILIBNAME}f90.a: mpi.o mpi_constants.o mpi_sizeofs.o 
	${AR} cr lib${MPILIBNAME}f90.a $?
	${RANLIB} lib${MPILIBNAME}f90.a
# --------------------------------------------------------------------------
# Install target
install:  FORCE_TARGET 
	if [ ! -d ${DESTDIR}${prefix} ] ; then $(MKDIR_P) ${DESTDIR}${prefix} ; fi
	if [ ! -d ${DESTDIR}${includedir} ] ; then $(MKDIR_P) ${DESTDIR}${includedir} ; fi
	$(INSTALL_DATA) $(MPIMOD).$(MOD) ${DESTDIR}${includedir}/$(MPIMOD).$(MOD)
	$(INSTALL_DATA) $(MPISIZEOFMOD).$(MOD) ${DESTDIR}${includedir}/$(MPISIZEOFMOD).$(MOD)
	if [ ! -d ${DESTDIR}${exec_prefix} ] ; then $(MKDIR_P) ${DESTDIR}${exec_prefix} ; fi
	if [ ! -d ${DESTDIR}${libdir} ] ; then $(MKDIR_P) ${DESTDIR}${libdir} ; fi
	$(INSTALL_DATA) lib${MPILIBNAME}f90.a ${DESTDIR}${libdir}/lib${MPILIBNAME}f90.a
	if [ -s mpimod.pcl ] ; then $(INSTALL_DATA) mpimod.pcl ${DESTDIR}${includedir}/mpimod.pcl ; fi
	if [ -s mpimod.pc ] ; then $(INSTALL_DATA) mpimod.pc ${DESTDIR}${includedir}/mpimod.pc ; fi

install-strip:
	$(MAKE) INSTALL_STRIP_FLAG=-s install
uninstall: 
	-rm -f ${DESTDIR}${includedir}/$(MPIMOD).$(MOD)
	-rm -f ${DESTDIR}${includedir}/$(MPISIZEOFMOD).$(MOD)
	-rm -f ${DESTDIR}${libdir}/lib${MPILIBNAME}f90.a
	-rm -f ${DESTDIR}${includedir}/mpimod.pcl
	-rm -f ${DESTDIR}${includedir}/mpimod.pc
installcheck: 
# --------------------------------------------------------------------------
dependencies:
# --------------------------------------------------------------------------
HEADERFILES     = $(HEADERS)
SOURCEFILES     = $(SOURCES)
tags: TAGS
TAGS: Makefile
# --------------------------------------------------------------------------

# We need to tell some compilers (e.g., Solaris f90) to look in the current 
# directory when the source file is not in the working directory (i.e.,
# in a VPATH build)

all-preamble: $(MPIMOD).$(MOD)

# Thes copy line in this step makes the F90 modules available to 
# the mpif90 script before an install takes place
# The if handles the Intel F90 compiler, which has an unusual interface
# (The mpimod.pcl file should contain only a local mpimod.pc name; if
# it contains a file name in another directory and that file does not 
# exist, the compiler may refuse to compile the file)
#
# FIXME: We may want to edit the mpif.h to convert Fortran77-specific
# items (such as an integer*8 used for file offsets) into the 
# corresponding Fortran 90 KIND type, to accomodate compilers that
# reject non-standard features such as integer*8 (such as the Intel
# Fortran compiler with -std95).
# We need the MPI constants in a separate module for some of the
# interface definitions (the ones that need MPI_ADDRESS_KIND or
# MPI_OFFSET_KIND)
$(MPIMOD).$(MOD): $(MPICONSTMOD).$(MOD) $(MPISIZEOFMOD).$(MOD) \
		  $(srcdir)/mpi.f90 mpifnoext.h
	@if [ -n "@F90_WORK_FILES_ARG@" ] ; then \
	    rm -f mpimod.pc mpimod.pcl ; \
	    echo "mpimod.pc" > mpimod.pcl ; \
	    echo $(F90_COMPILE_MODS) @F90_WORK_FILES_ARG@ -c $(srcdir)/mpi.f90 ; \
	    $(F90_COMPILE_MODS) @F90_WORK_FILES_ARG@ -c $(srcdir)/mpi.f90 ; \
	    cp mpimod.pc ../../../src/include/mpimod.pc ; \
	    cp mpimod.pcl ../../../src/include/mpimod.pcl ; \
	else \
	    if [ "$(F90EXT)" != "f90" ] ; then \
	        ln -sf mpi.f90 mpi.$(F90EXT) ; \
	    fi ; \
	    echo $(F90_COMPILE_MODS) -c $(srcdir)/mpi.$(F90EXT) ; \
	    $(F90_COMPILE_MODS) -c $(srcdir)/mpi.$(F90EXT) ; \
	    if [ "$(F90EXT)" != "f90" ] ; then \
	        rm -f mpi.$(F90EXT) ; \
	    fi ; \
	fi

$(MPICONSTMOD).$(MOD): $(srcdir)/mpi_constants.f90 mpifnoext.h
	@if [ -n "@F90_WORK_FILES_ARG@" ] ; then \
	    rm -f mpimod.pc mpimod.pcl ; \
	    echo "mpimod.pc" > mpimod.pcl ; \
	    echo $(F90_COMPILE_MODS) @F90_WORK_FILES_ARG@ -c $(srcdir)/mpi_constants.f90 ; \
	    $(F90_COMPILE_MODS) @F90_WORK_FILES_ARG@ -c $(srcdir)/mpi.f90 ; \
	    cp mpimod.pc ../../../src/include/mpimod.pc ; \
	    cp mpimod.pcl ../../../src/include/mpimod.pcl ; \
	else \
	    if [ "$(F90EXT)" != "f90" ] ; then \
	        ln -sf mpi_constants.f90 mpi_constants.$(F90EXT) ; \
	    fi ; \
	    echo $(F90_COMPILE_MODS) -c $(srcdir)/mpi_constants.$(F90EXT) ; \
	    $(F90_COMPILE_MODS) -c $(srcdir)/mpi_constants.$(F90EXT) ; \
	    if [ "$(F90EXT)" != "f90" ] ; then \
	        rm -f mpi_constants.$(F90EXT) ; \
	    fi ; \
	fi

$(MPISIZEOFMOD).$(MOD): mpi_sizeofs.f90 mpifnoext.h
	@if [ -n "@F90_WORK_FILES_ARG@" ] ; then \
	    rm -f mpimod.pc mpimod.pcl ; \
	    echo "mpimod.pc" > mpimod.pcl ; \
	    echo $(F90_COMPILE_MODS) @F90_WORK_FILES_ARG@ -c mpi_sizeofs.f90 ; \
	    $(F90_COMPILE_MODS) @F90_WORK_FILES_ARG@ -c mpi_sizeofs.f90 ; \
	    cp mpimod.pc ../../../src/include/mpimod.pc ; \
	    cp mpimod.pcl ../../../src/include/mpimod.pcl ; \
	else \
	    if [ "$(F90EXT)" != "f90" ] ; then \
	        ln -sf mpi_sizeofs.f90 mpi_sizeofs.$(F90EXT) ; \
	    fi ; \
	    echo $(F90_COMPILE_MODS) -c mpi_sizeofs.$(F90EXT) ; \
	    $(F90_COMPILE_MODS) -c mpi_sizeofs.$(F90EXT) ; \
	    if [ "$(F90EXT)" != "f90" ] ; then \
	        rm -f mpi_sizeofs.$(F90EXT) ; \
	    fi ; \
	fi

# We need a free-format version of mpif.h with no external commands
mpifnoext.h: ../f77/mpif.h
	rm -f mpifnoext.h
	sed -e 's/^C/\!/g' -e '/EXTERNAL/d' \
		-e '/DOUBLE PRECISION/d' ../f77/mpif.h > mpifnoext.h

# To ensure that f90 can be used before a make-install step, we copy
# the library to the build directory (just like we do with the module files)
all-postamble:
	if [ -s lib${MPILIBNAME}f90.a ] ; then \
	   cp -p lib${MPILIBNAME}f90.a ../../../lib ; fi

clean-local:
	rm -f *.$(MOD)


# Documentation sources

distclean-local:
	rm -f lib${MPILIBNAME}f90.a
	rm -f ../../../bin/mpif90
	rm -f ../../../src/include/$(MPIMOD).$(MOD)
	rm -f ../../../lib/lib${MPILIBNAME}f90.a
	rm -f mpifnoext.h

FORCE_TARGET:

