1
1
Jeff Squyres ab398f4b9a fortran: ensure not to use [AM_]CPPFLAGS
Automake's Fortran compilation rules inexplicably use CPPFLAGS and
AM_CPPFLAGS.  Unfortunately, this can cause problems in some cases
(e.g., picking up already-installed mpi.mod in a system-default
include search path).

So in relevant module-using Fortran compilation Makefile.am's, zero
out CPPFLAGS and AM_CPPFLAGS.

This has a side-effect of requiring that we compile the one .c file in
the F08 library in a new, separate subdirectory (with its own
Makefile.am that does _not_ have CPPFLAGS/AM_CPPFLAGS zeroed out).

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
2020-02-03 14:45:32 -08:00

99 строки
2.6 KiB
Makefile

#
# Copyright (c) 2012-2019 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Note that Automake's Fortran-buidling rules uses CPPFLAGS and
# AM_CPPFLAGS. This can cause weirdness (e.g.,
# https://github.com/open-mpi/ompi/issues/7253). Let's just zero
# those out and rely on AM_FCFLAGS.
CPPFLAGS =
AM_CPPFLAGS =
#
# Only do the stuff in this file if we're going to build
# the mpi_f08 ext modules.
#
if OMPI_BUILD_FORTRAN_USEMPI_OR_USEMPIF08_EXT
# Setup
AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/base \
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08 \
-I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90)
flibs =
#
# "use mpi_f08" ext module
#
# If we're building the Fortran "use mpi_f08" bindings, compile and
# generate the mpi_f08_ext module file. Do this by compiling a fake
# library; the modulefile will be created as a side-effect of
# compiling usempif08-ext.f90.
#
if OMPI_BUILD_FORTRAN_USEMPIF08_EXT
flibs += libforce_usempif08_module_to_be_built.la
libforce_usempif08_module_to_be_built_la_SOURCES = mpi-f08-ext-module.F90
#
# Automake doesn't do Fortran dependency analysis, so must list them
# manually here. Bummer!
#
mpi_f08_ext.lo: $(top_builddir)/ompi/mpi/fortran/use-mpi-f08-modules/mpi-f08-types.lo
mpi_f08_ext.lo: mpi-f08-ext-module.F90
endif
noinst_LTLIBRARIES = $(flibs)
#
# Clean up all F90 module files and all generated files
#
MOSTLYCLEANFILES = *.mod
CLEANFILES += *.i90
#
# Install the generated .mod files. Unfortunately, each F90 compiler
# may generate different filenames, so we have to use a glob. :-(
#
install-exec-hook:
@ for file in `ls *.mod`; do \
echo $(INSTALL) $$file $(DESTDIR)$(libdir); \
$(INSTALL) $$file $(DESTDIR)$(libdir); \
done
uninstall-local:
@ for file in `ls *.mod`; do \
echo rm -f $(DESTDIR)$(libdir)/$$file; \
rm -f $(DESTDIR)$(libdir)/$$file; \
done
else
# If we're not building either of the modules, we still need stubs for
# install-exec-hook and uninstall-local, due to a bug in automake. :-(
install-exec-hook:
uninstall-local:
endif
# Remove the auto-generated files (they are generated by configure)
distclean-local:
rm -f mpi-f08-ext-module.F90