1
1

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>
This commit is contained in:
Jeff Squyres 2019-12-31 07:06:51 -08:00
parent f4a47a5a8e
commit ab398f4b9a
11 changed files with 107 additions and 17 deletions

View File

@ -1,6 +1,6 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2009-2019 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2017-2018 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2018 Los Alamos National Security, LLC. All rights
@ -38,6 +38,7 @@ AC_DEFUN([OMPI_CONFIG_FILES],[
ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-file-interfaces.h
ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-removed-interfaces.h
ompi/mpi/fortran/use-mpi-f08/Makefile
ompi/mpi/fortran/use-mpi-f08/base/Makefile
ompi/mpi/fortran/use-mpi-f08/bindings/Makefile
ompi/mpi/fortran/use-mpi-f08/mod/Makefile
ompi/mpi/fortran/mpiext-use-mpi/Makefile

View File

@ -9,7 +9,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2017 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2010-2011 Sandia National Laboratories. All rights reserved.
# Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
@ -92,6 +92,7 @@ SUBDIRS = \
$(OMPI_MPIEXT_USEMPI_DIR) \
$(OMPI_FORTRAN_USEMPI_DIR) \
mpi/fortran/mpiext-use-mpi \
mpi/fortran/use-mpi-f08/base \
mpi/fortran/use-mpi-f08/mod \
mpi/fortran/use-mpi-f08/bindings \
$(OMPI_MPIEXT_USEMPIF08_DIRS) \
@ -124,6 +125,7 @@ DIST_SUBDIRS = \
mpi/fortran/use-mpi-ignore-tkr \
mpi/fortran/mpiext-use-mpi \
mpi/fortran/use-mpi-f08 \
mpi/fortran/use-mpi-f08/base \
mpi/fortran/use-mpi-f08/mod \
mpi/fortran/use-mpi-f08/bindings \
mpi/fortran/mpiext-use-mpi-f08 \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# 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.
@ -10,6 +10,13 @@
# $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.
@ -23,7 +30,7 @@ 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) $(FCFLAGS_f90)
-I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90)
flibs =

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# 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.
@ -10,6 +10,13 @@
# $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 ext modules.
@ -22,7 +29,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_OR_USEMPIF08_EXT
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-ignore-tkr \
-I$(top_srcdir) $(FCFLAGS_f90)
-I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90)
flibs =

View File

@ -1,6 +1,6 @@
# -*- makefile.am -*-
#
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012-2013 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
@ -23,6 +23,13 @@
include $(top_srcdir)/Makefile.ompi-rules
# 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 =
# This Makefile is only relevant if we're building the "use mpi_f08"
# MPI bindings.
if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS
@ -32,7 +39,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include \
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \
$(OMPI_FC_MODULE_FLAG)mod \
$(OMPI_FC_MODULE_FLAG)bindings \
-I$(top_srcdir) $(FCFLAGS_f90)
-I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90)
MOSTLYCLEANFILES = *.mod
@ -801,8 +808,7 @@ pmpi_api_files = \
lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES = \
$(mpi_api_files) \
$(pmpi_api_files) \
mpi-f08.F90 \
buffer_detach.c
mpi-f08.F90
# These are generated; do not ship them
nodist_lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES =
@ -818,12 +824,17 @@ endif
#
# Include the mpi_f08-based MPI extensions in libmpi_usempif08, too.
#
# Also include the one .c file that we need in this library -- because
# we zero out CPPFLAGS and AM_CPPFLAGS in this Makefile.am, we have to
# compile that .c file in a separate directory / Makefile.
#
lib@OMPI_LIBMPI_NAME@_usempif08_la_LIBADD = \
$(OMPI_MPIEXT_USEMPIF08_LIBS) \
$(top_builddir)/ompi/mpi/fortran/mpif-h/lib@OMPI_LIBMPI_NAME@_mpifh.la \
$(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \
mod/libusempif08_internal_modules.la
mod/libusempif08_internal_modules.la \
base/libusempif08_ccode.la
lib@OMPI_LIBMPI_NAME@_usempif08_la_DEPENDENCIES = $(module_sentinel_files)
lib@OMPI_LIBMPI_NAME@_usempif08_la_LDFLAGS = -version-info $(libmpi_usempif08_so_version)

View File

@ -0,0 +1,34 @@
# -*- makefile -*-
#
# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
#
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_srcdir)/Makefile.ompi-rules
# This Makefile is only relevant if we're building the "use mpi_f08"
# MPI bindings.
if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS
# This directory only exists so that we can separate C compilation
# from Fortran compilation. Specifically: 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). So when compiling
# Fortran, we should zero out CPPFLAGS and AM_CPPFLAGS.
# HOWEVER, we have one .c file in the use-mpi-f08 library. So we have
# to split it out to its own directory / Makefile.am where CPPFLAGS /
# AM_CPPFLAGS are *not* zeroed out.
noinst_LTLIBRARIES = libusempif08_ccode.la
libusempif08_ccode_la_SOURCES = \
buffer_detach.c
endif

View File

@ -1,6 +1,6 @@
# -*- makefile -*-
#
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012-2013 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
@ -20,6 +20,13 @@
include $(top_srcdir)/Makefile.ompi-rules
# 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 =
# This Makefile is only relevant if we're building the "use mpi_f08"
# MPI bindings.
if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS
@ -29,7 +36,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include \
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \
$(OMPI_FC_MODULE_FLAG). \
$(OMPI_FC_MODULE_FLAG)../mod \
-I$(top_srcdir) $(FCFLAGS_f90)
-I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90)
MOSTLYCLEANFILES = *.mod

View File

@ -1,6 +1,6 @@
# -*- makefile -*-
#
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012-2013 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
@ -20,6 +20,13 @@
include $(top_srcdir)/Makefile.ompi-rules
# 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 =
# This Makefile is only relevant if we're building the "use mpi_f08"
# MPI bindings.
if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS
@ -28,7 +35,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include \
-I$(top_srcdir)/ompi/include \
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \
$(OMPI_FC_MODULE_FLAG). \
-I$(top_srcdir) $(FCFLAGS_f90)
-I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90)
MOSTLYCLEANFILES = *.mod

View File

@ -15,6 +15,13 @@
include $(top_srcdir)/Makefile.ompi-rules
# 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 =
# This Makefile is only relevant if we're building the ignore-TKR "use
# mpi" MPI bindings.
if OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS

View File

@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2007 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2014-2016 Research Organization for Information Science
@ -32,6 +32,13 @@ include $(top_srcdir)/Makefile.ompi-rules
# this directory -- instead, they compile
# ompi/fortran/use-mpi-ignore-tkr.
# 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 =
if OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS
########################################################################
@ -41,7 +48,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS
# current directory) because it is generated.
AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \
$(OMPI_FC_MODULE_FLAG). -I$(srcdir) -I. \
$(OMPI_FC_MODULE_FLAG). -I$(top_srcdir) -I$(top_builddir) -I. \
-I$(top_builddir)/ompi/mpi/fortran/use-mpi-tkr $(FCFLAGS_f90)
# Do different things if the top-level configure decided that we're