2004-01-08 00:39:46 +03:00
|
|
|
# -*- makefile -*-
|
|
|
|
#
|
2005-11-05 22:57:48 +03:00
|
|
|
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
# University Research and Technology
|
|
|
|
# Corporation. All rights reserved.
|
|
|
|
# Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
# of Tennessee Research Foundation. All rights
|
|
|
|
# reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
# University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
# Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
# All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
# $COPYRIGHT$
|
|
|
|
#
|
|
|
|
# Additional copyrights may follow
|
|
|
|
#
|
2004-01-08 00:39:46 +03:00
|
|
|
# $HEADER$
|
|
|
|
#
|
|
|
|
|
2005-08-24 07:10:22 +04:00
|
|
|
# This Makefile.am is quite complex and confusing. Part of the
|
|
|
|
# problem is that Libtool (v1.5.18) does not understand F90, so we
|
|
|
|
# have to do a few things manually (and no shared libraries). Here's a
|
|
|
|
# summary of what is happening:
|
|
|
|
#
|
|
|
|
# Depedencies / who generates whom:
|
|
|
|
#
|
|
|
|
# configure generates fortran_kinds.sh
|
|
|
|
# |
|
|
|
|
# \|/
|
|
|
|
# fortran_kinds.sh ----> sourced by scripts/* ----> generates mpi_*.f90
|
|
|
|
# | |
|
|
|
|
# \|/ |
|
|
|
|
# generates mpi-f90-interfaces.h |
|
|
|
|
# / |
|
|
|
|
# mpi_kinds.f90 --------> generates mpi_kinds module |
|
|
|
|
# / (exact filename unknown) |
|
|
|
|
# \/ / \ |
|
|
|
|
# mpi-f90-interfaces.h / \ |
|
|
|
|
# | / \ |
|
|
|
|
# \|/ \/ \/ \|/
|
|
|
|
# used by mpi.f90 used by mpi_*.f90
|
|
|
|
# / | |
|
|
|
|
# / \|/ \|/
|
|
|
|
# / generates mpi.o generates mpi_*.o
|
|
|
|
# \/ \ /
|
|
|
|
# generates mpi module \/ \/
|
|
|
|
# (filename unknown) generates libmpi_f90.a
|
|
|
|
#
|
|
|
|
# Once you understand this diagram, this Makefile is much more clear.
|
|
|
|
#
|
|
|
|
|
2005-09-07 09:54:53 +04:00
|
|
|
|
2004-01-08 00:39:46 +03:00
|
|
|
|
2005-02-06 02:50:01 +03:00
|
|
|
SUBDIRS = scripts
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
AM_FCFLAGS = -I$(top_builddir)/ompi/include $(OMPI_FC_MODULE_FLAG).
|
2005-02-06 23:43:57 +03:00
|
|
|
|
2005-04-15 00:54:47 +04:00
|
|
|
# We have to EXTRA_DIST mpi_kinds.f90 because there is no explicit
|
|
|
|
# Automake rule to compile this file.
|
|
|
|
|
|
|
|
EXTRA_DIST = mpi_kinds.f90
|
|
|
|
|
2005-02-06 23:43:57 +03:00
|
|
|
# Override the default f90 rules because we have to insert
|
|
|
|
# $(FCFLAGS_f90) right before the source filename. This is necessary
|
|
|
|
# for cases where the compiler expects source files to end in .f, and
|
|
|
|
# if we want our .f90 files to be compilable, we have to insert a
|
|
|
|
# special flag right before the source filename (e.g., xlf).
|
|
|
|
|
|
|
|
.f90.o:
|
|
|
|
$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
|
|
|
|
|
|
|
|
.f90.obj:
|
2005-08-26 20:22:33 +04:00
|
|
|
$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`
|
|
|
|
|
|
|
|
.f90.lo:
|
|
|
|
$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
|
|
|
|
|
2005-02-06 23:43:57 +03:00
|
|
|
|
2005-04-15 00:54:47 +04:00
|
|
|
# Do different things if the top-level configure decided that we're
|
|
|
|
# going to build F90 bindings or not.
|
|
|
|
|
2005-08-24 06:11:02 +04:00
|
|
|
lib_LIBRARIES =
|
2005-02-06 02:50:01 +03:00
|
|
|
if OMPI_WANT_F90_BINDINGS
|
2005-04-15 00:54:47 +04:00
|
|
|
|
2005-08-26 22:26:01 +04:00
|
|
|
# We have to build this before the other ones.
|
|
|
|
|
|
|
|
BUILT_SOURCES = mpi_kinds.ompi_module
|
|
|
|
|
2005-04-15 00:54:47 +04:00
|
|
|
# Add the f90 library to the list of libraries to build
|
|
|
|
|
2005-08-24 06:11:02 +04:00
|
|
|
lib_LIBRARIES += libmpi_f90.a
|
2005-02-06 02:50:01 +03:00
|
|
|
|
2005-04-15 00:54:47 +04:00
|
|
|
# Ensure that the F90 interfaces are re-generated based on the values
|
|
|
|
# that come in from configure
|
2005-04-13 15:54:36 +04:00
|
|
|
|
2005-04-15 00:54:47 +04:00
|
|
|
mpi-f90-interfaces.h: fortran_kinds.sh
|
2005-04-13 15:54:36 +04:00
|
|
|
|
2005-08-31 14:56:01 +04:00
|
|
|
CLEANFILES += mpi-f90-interfaces.h
|
|
|
|
|
2005-11-10 19:04:39 +03:00
|
|
|
# SIDENOTE: We currently have code in mpi-f90-interfaces.h.sh to
|
|
|
|
# generate interface declarations for all the "two buffer" functions
|
|
|
|
# (e.g., MPI_Reduce). This actually creates a problem for most
|
|
|
|
# compilers, because it results in an exponential explosion of
|
|
|
|
# functions generated -- most compilers will segv (particularly with
|
|
|
|
# --with-f90-mcx-array-dim values of >2). But this code is useful,
|
|
|
|
# and I don't want to delete it (yes, we could get it back from SVN
|
|
|
|
# history, but I don't want to re-integrate it) -- f90 compilers *may*
|
|
|
|
# someday be able to handle this (i.e., our *code* is not wrong -- the
|
|
|
|
# *compilers* are wrong). So I'm simply adding a hard-coded value
|
|
|
|
# here to disable the interface generation stuff in the script; it can
|
|
|
|
# be made a condition (e.g., via configure test or --enable option, or
|
|
|
|
# somesuch) later if necessary.
|
|
|
|
|
|
|
|
WANT_2BUFFER_FUNCTIONS=0
|
|
|
|
|
2005-04-15 00:54:47 +04:00
|
|
|
# Run scripts to generate the f90 source files. We only need to
|
|
|
|
# generate the .f90 files once, so the "test" checks to see if the
|
|
|
|
# file exists before running the script. However, the
|
|
|
|
# mpi-f90-interfaces.h file may need to be generated multiple times
|
|
|
|
# (even if it already exists), such as if someone re-runs configure
|
2005-08-24 06:11:02 +04:00
|
|
|
# and changes the value fortran_kinds.sh (which is taken care of by
|
|
|
|
# the mpi-f90-interfaces.h dependency on fortran_kinds.sh, above).
|
|
|
|
|
|
|
|
mpi-f90-interfaces.h:
|
|
|
|
@ p="`pwd`"; \
|
2005-11-10 19:04:39 +03:00
|
|
|
echo $(srcdir)/scripts/mpi-f90-interfaces.h.sh $$p $(WANT_2BUFFER_FUNCTIONS) \> $@; \
|
|
|
|
$(srcdir)/scripts/mpi-f90-interfaces.h.sh $$p $(WANT_2BUFFER_FUNCTIONS) > $@
|
2005-04-15 00:54:47 +04:00
|
|
|
|
2005-08-24 06:11:02 +04:00
|
|
|
# Ensure that the mpi_kinds F90 module is generated before compiling
|
|
|
|
# any of the sources (because many/all of these sources "use
|
|
|
|
# mpi_kinds"). We unfortunately can't know ahead of time the exact
|
|
|
|
# filename of the generated F90 module file (because F90 compilers
|
|
|
|
# have not standardized on the output filename format), so we have to
|
|
|
|
# add our own explicit dependency to compile the module. :-(
|
|
|
|
|
|
|
|
$(libmpi_f90_a_SOURCES) $(nodist_libmpi_f90_a_SOURCES): mpi_kinds.ompi_module
|
|
|
|
|
|
|
|
mpi_kinds.ompi_module: mpi_kinds.f90
|
2005-12-21 00:43:04 +03:00
|
|
|
$(FCCOMPILE) -c $(FCFLAGS_f90) $<
|
2005-08-24 06:11:02 +04:00
|
|
|
@ touch mpi_kinds.ompi_module
|
|
|
|
|
|
|
|
# Unbelievably, some versions of sh (cough cough Solaris 9 cough
|
|
|
|
# cough) actually seem to internally perform a "cd" into a
|
|
|
|
# subdirectory when you run "./foo/bar", such that if you try to
|
|
|
|
# source a script in the top-level directory in the bar script (e.g.,
|
|
|
|
# ". some_script" in the bar script), it will try to run it in the
|
|
|
|
# "foo" subdirectory, rather than the top-level directory! #$@#$%#$%
|
|
|
|
# So we have to pass in the pwd to the scripts so that they know where
|
|
|
|
# some_script is.
|
|
|
|
|
|
|
|
$(nodist_libmpi_f90_a_SOURCES):
|
2005-04-15 00:54:47 +04:00
|
|
|
@ if test ! -r $@ -o "$@" = "mpi-f90-interfaces.h"; then \
|
2005-08-24 06:11:02 +04:00
|
|
|
p="`pwd`"; \
|
|
|
|
echo $(srcdir)/scripts/$@.sh $$p \> $@; \
|
|
|
|
$(srcdir)/scripts/$@.sh $$p > $@ ; \
|
2005-04-15 00:54:47 +04:00
|
|
|
fi
|
2005-08-24 06:11:02 +04:00
|
|
|
|
|
|
|
# Automake doesn't know how to do F90 dependency analysis, so manually
|
|
|
|
# list this here (i.e., "mpi-f90-interfaces.h" is included in
|
|
|
|
# mpi.f90).
|
|
|
|
|
|
|
|
# Print a warning indicating that compiling mpi.f90 can take a while.
|
|
|
|
# The only way to do this portably is to have our own rules for mpi.o
|
|
|
|
# and mpi.obj (having a "fake" target that just has echo statement in
|
|
|
|
# it may trigger mpi.o|obj to be rebuilt because the fake name doesn't
|
|
|
|
# exist; there aren't good portable ways to indicate that the target
|
|
|
|
# name is fake and should never exist).
|
|
|
|
|
|
|
|
mpi.o: mpi.f90 mpi-f90-interfaces.h
|
|
|
|
@echo "***************************************************************"
|
|
|
|
@echo "* Compiling the mpi.f90 file may take a few minutes."
|
|
|
|
@echo "* This is quite normal -- do not be alarmed if the compile"
|
|
|
|
@echo "* process seems to 'hang' at this point for several minutes."
|
|
|
|
@echo "***************************************************************"
|
|
|
|
$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
|
|
|
|
|
|
|
|
mpi.obj: mpi.f90 mpi-f90-interfaces.h
|
|
|
|
@echo "***************************************************************"
|
|
|
|
@echo "* Compiling the mpi.f90 file may take a few minutes."
|
|
|
|
@echo "* This is quite normal -- do not be alarmed if the compile"
|
|
|
|
@echo "* process seems to 'hang' at this point for several minutes."
|
|
|
|
@echo "***************************************************************"
|
2005-08-26 20:22:33 +04:00
|
|
|
$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`
|
2005-08-24 06:11:02 +04:00
|
|
|
|
2005-04-15 00:54:47 +04:00
|
|
|
else
|
2005-08-24 06:11:02 +04:00
|
|
|
lib_LIBRARIES +=
|
2005-04-15 00:54:47 +04:00
|
|
|
endif
|
2005-04-13 15:54:36 +04:00
|
|
|
|
2005-08-24 06:11:02 +04:00
|
|
|
# mpi.f90 is the only f90 source file directly in libmpif90 that gets
|
|
|
|
# distributed (mpi_kinds.f90 is also distributed, but it's only
|
|
|
|
# indirectly included in libmpif90 -- via "use mpi_kinds").
|
|
|
|
|
|
|
|
libmpi_f90_a_SOURCES = mpi.f90
|
2005-04-13 15:54:36 +04:00
|
|
|
|
2005-08-24 06:11:02 +04:00
|
|
|
# These files are all generated by scripts in the scripts/ directory.
|
2005-02-06 02:50:01 +03:00
|
|
|
|
2005-08-24 06:11:02 +04:00
|
|
|
nodist_libmpi_f90_a_SOURCES = \
|
2005-02-06 02:50:01 +03:00
|
|
|
mpi_address_f90.f90 \
|
|
|
|
mpi_bcast_f90.f90 \
|
|
|
|
mpi_bsend_f90.f90 \
|
|
|
|
mpi_bsend_init_f90.f90 \
|
|
|
|
mpi_buffer_attach_f90.f90 \
|
|
|
|
mpi_buffer_detach_f90.f90 \
|
|
|
|
mpi_file_iread_f90.f90 \
|
|
|
|
mpi_file_iread_at_f90.f90 \
|
|
|
|
mpi_file_iread_shared_f90.f90 \
|
|
|
|
mpi_file_iwrite_f90.f90 \
|
|
|
|
mpi_file_iwrite_at_f90.f90 \
|
|
|
|
mpi_file_iwrite_shared_f90.f90 \
|
|
|
|
mpi_file_read_f90.f90 \
|
|
|
|
mpi_file_read_all_f90.f90 \
|
|
|
|
mpi_file_read_all_begin_f90.f90 \
|
|
|
|
mpi_file_read_all_end_f90.f90 \
|
|
|
|
mpi_file_read_at_f90.f90 \
|
|
|
|
mpi_file_read_at_all_f90.f90 \
|
|
|
|
mpi_file_read_at_all_begin_f90.f90 \
|
|
|
|
mpi_file_read_at_all_end_f90.f90 \
|
|
|
|
mpi_file_read_ordered_f90.f90 \
|
|
|
|
mpi_file_read_ordered_begin_f90.f90 \
|
|
|
|
mpi_file_read_ordered_end_f90.f90 \
|
|
|
|
mpi_file_read_shared_f90.f90 \
|
|
|
|
mpi_file_write_f90.f90 \
|
|
|
|
mpi_file_write_all_f90.f90 \
|
|
|
|
mpi_file_write_all_begin_f90.f90 \
|
|
|
|
mpi_file_write_all_end_f90.f90 \
|
|
|
|
mpi_file_write_at_f90.f90 \
|
|
|
|
mpi_file_write_at_all_f90.f90 \
|
|
|
|
mpi_file_write_at_all_begin_f90.f90 \
|
|
|
|
mpi_file_write_at_all_end_f90.f90 \
|
|
|
|
mpi_file_write_ordered_f90.f90 \
|
|
|
|
mpi_file_write_ordered_begin_f90.f90 \
|
|
|
|
mpi_file_write_ordered_end_f90.f90 \
|
|
|
|
mpi_file_write_shared_f90.f90 \
|
|
|
|
mpi_ibsend_f90.f90 \
|
|
|
|
mpi_irecv_f90.f90 \
|
|
|
|
mpi_irsend_f90.f90 \
|
|
|
|
mpi_isend_f90.f90 \
|
|
|
|
mpi_issend_f90.f90 \
|
|
|
|
mpi_recv_f90.f90 \
|
|
|
|
mpi_recv_init_f90.f90 \
|
|
|
|
mpi_rsend_f90.f90 \
|
|
|
|
mpi_rsend_init_f90.f90 \
|
|
|
|
mpi_send_f90.f90 \
|
|
|
|
mpi_send_init_f90.f90 \
|
|
|
|
mpi_sendrecv_replace_f90.f90 \
|
|
|
|
mpi_ssend_f90.f90 \
|
2006-01-28 18:38:37 +03:00
|
|
|
mpi_ssend_init_f90.f90 \
|
2005-02-06 02:50:01 +03:00
|
|
|
mpi_accumulate_f90.f90 \
|
|
|
|
mpi_get_f90.f90 \
|
|
|
|
mpi_put_f90.f90 \
|
|
|
|
mpi_win_create_f90.f90
|
2006-01-28 18:38:37 +03:00
|
|
|
|
2005-02-06 02:50:01 +03:00
|
|
|
|
|
|
|
#
|
2005-04-15 00:54:47 +04:00
|
|
|
# Clean up all F90 module files and all generated files
|
2005-02-06 02:50:01 +03:00
|
|
|
#
|
|
|
|
|
2005-08-24 06:11:02 +04:00
|
|
|
MOSTLYCLEANFILES = *.mod *.ompi_module
|
|
|
|
DISTCLEANFILES = $(nodist_libmpi_f90_a_SOURCES)
|
2005-04-12 00:55:02 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# Install the generated .mod files. Unfortunately, each F90 compiler
|
|
|
|
# may generate different filenames, so we have to use a glob. :-(
|
|
|
|
#
|
|
|
|
|
|
|
|
if OMPI_WANT_F90_BINDINGS
|
|
|
|
install-exec-hook:
|
|
|
|
@ for file in `ls *.mod`; do \
|
2006-02-12 17:16:19 +03:00
|
|
|
rm -f $$file $(DESTDIR)$(libdir); \
|
2005-04-12 00:55:02 +04:00
|
|
|
echo $(INSTALL) $$file $(DESTDIR)$(libdir); \
|
|
|
|
$(INSTALL) $$file $(DESTDIR)$(libdir); \
|
2006-02-12 17:16:19 +03:00
|
|
|
rm -f $(DESTDIR)$(includedir)/$$file ; \
|
2006-02-05 02:31:30 +03:00
|
|
|
echo $(LN_S) $(DESTDIR)$(libdir)/$$file $(DESTDIR)$(includedir)/$$file ; \
|
|
|
|
$(LN_S) $(DESTDIR)$(libdir)/$$file $(DESTDIR)$(includedir)/$$file ; \
|
2005-04-12 00:55:02 +04:00
|
|
|
done
|
|
|
|
|
|
|
|
uninstall-local:
|
|
|
|
@ for file in `ls *.mod`; do \
|
|
|
|
echo rm -f $(DESTDIR)$(libdir)/$$file; \
|
|
|
|
rm -f $(DESTDIR)$(libdir)/$$file; \
|
2006-02-05 02:31:30 +03:00
|
|
|
rm -f $(DESTDIR)$(includedir)/$$file; \
|
2005-04-12 00:55:02 +04:00
|
|
|
done
|
2005-04-12 20:34:42 +04:00
|
|
|
else
|
|
|
|
|
|
|
|
# Need to have empty targets because AM can't handle having an
|
|
|
|
# AM_CONDITIONAL was targets in the "if" statement but not in the
|
|
|
|
# "else". :-(
|
|
|
|
|
|
|
|
install-exec-hook:
|
|
|
|
uninstall-local:
|
2005-04-12 00:55:02 +04:00
|
|
|
endif
|