From f821c5f88a72f23fe99b64025350644655db98a9 Mon Sep 17 00:00:00 2001 From: Seth Underwood Date: Mon, 13 Jan 2020 16:52:16 -0500 Subject: [PATCH] Add CPPDEFS used in autotools to templates (#28) Added flags that are used in FMS with autotools to allow users to continue using mkmf after the addition of autotools. --- templates/linux-gnu.mk | 12 +++++++--- templates/linux-intel.mk | 6 +++++ templates/linux-ubuntu-trusty-gnu.mk | 6 +++++ templates/linux-ubuntu-xenial-gnu.mk | 6 +++++ templates/macOS-gnu8-mpich3.mk | 5 ++++ templates/nccs-intel.mk | 6 +++++ templates/ncrc-cray.mk | 35 +++++++++------------------- templates/ncrc-gnu.mk | 35 +++++++++------------------- templates/ncrc-intel.mk | 30 +++++++++++++----------- templates/ncrc-pgi.mk | 31 ++++++++---------------- templates/osx-gnu.mk | 5 ++++ templates/triton-gnu.mk | 6 +++++ 12 files changed, 98 insertions(+), 85 deletions(-) diff --git a/templates/linux-gnu.mk b/templates/linux-gnu.mk index e54f69c..4a1be4f 100644 --- a/templates/linux-gnu.mk +++ b/templates/linux-gnu.mk @@ -78,6 +78,12 @@ endif MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF + +# Additional Preprocessor Macros needed due to Autotools and CMake +CPPDEFS += -DHAVE_GETTID -DHAVE_SCHED_GETAFFINITY + # Macro for Fortran preprocessor FPPFLAGS := $(INCLUDES) # Fortran Compiler flags for the NetCDF library @@ -99,7 +105,7 @@ FFLAGS_VERBOSE = FFLAGS_COVERAGE = # Macro for C preprocessor -CPPFLAGS = $(INCLUDES) +CPPFLAGS := $(INCLUDES) # C Compiler flags for the NetCDF library CPPFLAGS += $(shell nc-config --cflags) # C Compiler flags for the MPICH MPI library @@ -120,8 +126,8 @@ CFLAGS_COVERAGE = # Optional Testing compile flags. Mutually exclusive from DEBUG, REPRO, and OPT # *_TEST will match the production if no new option(s) is(are) to be tested. -FFLAGS_TEST = $(FFLAGS_OPT) -CFLAGS_TEST = $(CFLAGS_OPT) +FFLAGS_TEST := $(FFLAGS_OPT) +CFLAGS_TEST := $(CFLAGS_OPT) # Linking flags LDFLAGS := diff --git a/templates/linux-intel.mk b/templates/linux-intel.mk index b825951..1498cc9 100644 --- a/templates/linux-intel.mk +++ b/templates/linux-intel.mk @@ -78,6 +78,12 @@ endif MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF + +# Additional Preprocessor Macros needed due to Autotools and CMake +CPPDEFS += -DHAVE_GETTID -DHAVE_SCHED_GETAFFINITY + # Macro for Fortran preprocessor FPPFLAGS = -fpp -Wp,-w $(INCLUDES) # Fortran Compiler flags for the NetCDF library diff --git a/templates/linux-ubuntu-trusty-gnu.mk b/templates/linux-ubuntu-trusty-gnu.mk index 97874af..789a938 100644 --- a/templates/linux-ubuntu-trusty-gnu.mk +++ b/templates/linux-ubuntu-trusty-gnu.mk @@ -77,6 +77,12 @@ endif MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF + +# Additional Preprocessor Macros needed due to Autotools and CMake +CPPDEFS += -DHAVE_GETTID -DHAVE_SCHED_GETAFFINITY + # Macro for Fortran preprocessor FPPFLAGS := $(INCLUDES) # Fortran Compiler flags for the NetCDF library diff --git a/templates/linux-ubuntu-xenial-gnu.mk b/templates/linux-ubuntu-xenial-gnu.mk index 579f26a..3163717 100644 --- a/templates/linux-ubuntu-xenial-gnu.mk +++ b/templates/linux-ubuntu-xenial-gnu.mk @@ -77,6 +77,12 @@ endif MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF + +# Additional Preprocessor Macros needed due to Autotools and CMake +CPPDEFS += -DHAVE_GETTID -DHAVE_SCHED_GETAFFINITY + # Macro for Fortran preprocessor FPPFLAGS := $(INCLUDES) # Fortran Compiler flags for the NetCDF library diff --git a/templates/macOS-gnu8-mpich3.mk b/templates/macOS-gnu8-mpich3.mk index c835f8e..3a608ad 100644 --- a/templates/macOS-gnu8-mpich3.mk +++ b/templates/macOS-gnu8-mpich3.mk @@ -85,6 +85,11 @@ endif #MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) MAKEFLAGS += --jobs=$(shell sysctl -n hw.ncpu) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF + +# Additional Preprocessor Macros needed due to Autotools and CMake + # Macro for Fortran preprocessor FPPFLAGS := $(INCLUDES) # Add -D__APPLE__ for Fortran if on OSX (i.e. Darwin) diff --git a/templates/nccs-intel.mk b/templates/nccs-intel.mk index d307da8..28fcd9c 100644 --- a/templates/nccs-intel.mk +++ b/templates/nccs-intel.mk @@ -78,6 +78,12 @@ endif MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF -Duse_libMPI + +# Additional Preprocessor Macros needed due to Autotools and CMake +CPPDEFS += -DHAVE_GETTID -DHAVE_SCHED_GETAFFINITY + # Macro for Fortran preprocessor FPPFLAGS = -fpp -Wp,-w $(INCLUDES) # Fortran Compiler flags for the NetCDF library diff --git a/templates/ncrc-cray.mk b/templates/ncrc-cray.mk index 2335156..e0c4951 100644 --- a/templates/ncrc-cray.mk +++ b/templates/ncrc-cray.mk @@ -38,10 +38,6 @@ VERBOSE = # If non-blank, add additional verbosity compiler OPENMP = # If non-blank, compile with openmp enabled -NO_OVERRIDE_LIMITS = # If non-blank, do not use the -qoverride-limits - # compiler option. Default behavior is to compile - # with -qoverride-limits. - NETCDF = # If value is '3' and CPPDEFS contains # '-Duse_netCDF', then the additional cpp macro # '-Duse_LARGEFILE' is added to the CPPDEFS macro. @@ -49,10 +45,6 @@ NETCDF = # If value is '3' and CPPDEFS contains INCLUDES = # A list of -I Include directories to be added to the # the compile command. -SSE = # The SSE options to be used to compile. If blank, - # than use the default SSE settings for the host. - # Current default is to use SSE2. - COVERAGE = # Add the code coverage compile options. # Need to use at least GNU Make version 3.81 @@ -78,8 +70,14 @@ endif MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF -Duse_libMPI + +# Additional Preprocessor Macros needed due to Autotools and CMake +CPPDEFS += -DHAVE_GETTID -DHAVE_SCHED_GETAFFINITY + # Macro for Fortran preprocessor -FPPFLAGS = $(INCLUDES) +FPPFLAGS := $(INCLUDES) # Fortran Compiler flags for the NetCDF library FPPFLAGS += $(shell nf-config --fflags) @@ -97,7 +95,7 @@ FFLAGS_VERBOSE = -e o -v FFLAGS_COVERAGE = # Macro for C preprocessor -CPPFLAGS = $(INCLUDES) +CPPFLAGS := $(INCLUDES) # C Compiler flags for the NetCDF library CPPFLAGS += $(shell nc-config --cflags) @@ -116,8 +114,8 @@ CFLAGS_COVERAGE = # Optional Testing compile flags. Mutually exclusive from DEBUG, REPRO, and OPT # *_TEST will match the production if no new option(s) is(are) to be tested. -FFLAGS_TEST = $(FFLAGS_OPT) -CFLAGS_TEST = $(CFLAGS_OPT) +FFLAGS_TEST := $(FFLAGS_OPT) +CFLAGS_TEST := $(CFLAGS_OPT) # Linking flags LDFLAGS := -h byteswapio @@ -149,15 +147,6 @@ FFLAGS += $(FFLAGS_NOOPENMP) LDFLAGS += $(LDFLAGS_NOOPENMP) endif -ifdef SSE -CFLAGS += $(SSE) -FFLAGS += $(SSE) -endif - -ifdef NO_OVERRIDE_LIMITS -FFLAGS += $(FFLAGS_OVERRIDE_LIMITS) -endif - ifdef VERBOSE CFLAGS += $(CFLAGS_VERBOSE) FFLAGS += $(FFLAGS_VERBOSE) @@ -166,9 +155,7 @@ endif ifeq ($(NETCDF),3) # add the use_LARGEFILE cppdef - ifneq ($(findstring -Duse_netCDF,$(CPPDEFS)),) - CPPDEFS += -Duse_LARGEFILE - endif + CPPDEFS += -Duse_LARGEFILE endif ifdef COVERAGE diff --git a/templates/ncrc-gnu.mk b/templates/ncrc-gnu.mk index 4babca4..f7bc37e 100644 --- a/templates/ncrc-gnu.mk +++ b/templates/ncrc-gnu.mk @@ -38,10 +38,6 @@ VERBOSE = # If non-blank, add additional verbosity compiler OPENMP = # If non-blank, compile with openmp enabled -NO_OVERRIDE_LIMITS = # If non-blank, do not use the -qoverride-limits - # compiler option. Default behavior is to compile - # with -qoverride-limits. - NETCDF = # If value is '3' and CPPDEFS contains # '-Duse_netCDF', then the additional cpp macro # '-Duse_LARGEFILE' is added to the CPPDEFS macro. @@ -49,10 +45,6 @@ NETCDF = # If value is '3' and CPPDEFS contains INCLUDES = # A list of -I Include directories to be added to the # the compile command. -SSE = # The SSE options to be used to compile. If blank, - # than use the default SSE settings for the host. - # Current default is to use SSE2. - COVERAGE = # Add the code coverage compile options. # Need to use at least GNU Make version 3.81 @@ -78,8 +70,14 @@ endif MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF -Duse_libMPI + +# Additional Preprocessor Macros needed due to Autotools and CMake +CPPDEFS += -DHAVE_GETTID -DHAVE_SCHED_GETAFFINITY + # Macro for Fortran preprocessor -FPPFLAGS = $(INCLUDES) +FPPFLAGS := $(INCLUDES) # Fortran Compiler flags for the NetCDF library FPPFLAGS += $(shell nf-config --fflags) @@ -97,7 +95,7 @@ FFLAGS_VERBOSE = -Wall -Wextra FFLAGS_COVERAGE = # Macro for C preprocessor -CPPFLAGS = -D__IFC $(INCLUDES) +CPPFLAGS := -D__IFC $(INCLUDES) # C Compiler flags for the NetCDF library CPPFLAGS += $(shell nc-config --cflags) @@ -116,8 +114,8 @@ CFLAGS_COVERAGE = # Optional Testing compile flags. Mutually exclusive from DEBUG, REPRO, and OPT # *_TEST will match the production if no new option(s) is(are) to be tested. -FFLAGS_TEST = $(FFLAGS_OPT) -CFLAGS_TEST = $(CFLAGS_OPT) +FFLAGS_TEST := $(FFLAGS_OPT) +CFLAGS_TEST := $(CFLAGS_OPT) # Linking flags LDFLAGS := @@ -149,15 +147,6 @@ FFLAGS += $(FFLAGS_OPENMP) LDFLAGS += $(LDFLAGS_OPENMP) endif -ifdef SSE -CFLAGS += $(SSE) -FFLAGS += $(SSE) -endif - -ifdef NO_OVERRIDE_LIMITS -FFLAGS += $(FFLAGS_OVERRIDE_LIMITS) -endif - ifdef VERBOSE CFLAGS += $(CFLAGS_VERBOSE) FFLAGS += $(FFLAGS_VERBOSE) @@ -166,9 +155,7 @@ endif ifeq ($(NETCDF),3) # add the use_LARGEFILE cppdef - ifneq ($(findstring -Duse_netCDF,$(CPPDEFS)),) - CPPDEFS += -Duse_LARGEFILE - endif + CPPDEFS += -Duse_LARGEFILE endif ifdef COVERAGE diff --git a/templates/ncrc-intel.mk b/templates/ncrc-intel.mk index 710bf83..dee48d0 100644 --- a/templates/ncrc-intel.mk +++ b/templates/ncrc-intel.mk @@ -49,9 +49,9 @@ NETCDF = # If value is '3' and CPPDEFS contains INCLUDES = # A list of -I Include directories to be added to the # the compile command. -SSE = -msse2 # The SSE options to be used to compile. If blank, - # than use the default SSE settings for the host. - # Current default is to use SSE2. +ISA = -msse2 # The Intel Instruction Set Archetecture (ISA) compile + # option to use. If blank, than use the default SSE + # settings for the host. Current default is to use SSE2. COVERAGE = # Add the code coverage compile options. @@ -78,8 +78,14 @@ endif MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF -Duse_libMPI + +# Additional Preprocessor Macros needed due to Autotools and CMake +CPPDEFS += -DHAVE_GETTID -DHAVE_SCHED_GETAFFINITY + # Macro for Fortran preprocessor -FPPFLAGS = -fpp -Wp,-w $(INCLUDES) +FPPFLAGS := -fpp -Wp,-w $(INCLUDES) # Fortran Compiler flags for the NetCDF library FPPFLAGS += $(shell nf-config --fflags) @@ -98,7 +104,7 @@ FFLAGS_VERBOSE = -v -V -what -warn all FFLAGS_COVERAGE = -prof-gen=srcpos # Macro for C preprocessor -CPPFLAGS = -D__IFC $(INCLUDES) +CPPFLAGS := -D__IFC $(INCLUDES) # C Compiler flags for the NetCDF library CPPFLAGS += $(shell nc-config --cflags) @@ -117,8 +123,8 @@ CFLAGS_COVERAGE = -prof-gen=srcpos # Optional Testing compile flags. Mutually exclusive from DEBUG, REPRO, and OPT # *_TEST will match the production if no new option(s) is(are) to be tested. -FFLAGS_TEST = $(FFLAGS_OPT) -CFLAGS_TEST = $(CFLAGS_OPT) +FFLAGS_TEST := $(FFLAGS_OPT) +CFLAGS_TEST := $(CFLAGS_OPT) # Linking flags LDFLAGS := @@ -150,9 +156,9 @@ FFLAGS += $(FFLAGS_OPENMP) LDFLAGS += $(LDFLAGS_OPENMP) endif -ifdef SSE -CFLAGS += $(SSE) -FFLAGS += $(SSE) +ifdef ISA +CFLAGS += $(ISA) +FFLAGS += $(ISA) endif ifdef NO_OVERRIDE_LIMITS @@ -167,9 +173,7 @@ endif ifeq ($(NETCDF),3) # add the use_LARGEFILE cppdef - ifneq ($(findstring -Duse_netCDF,$(CPPDEFS)),) - CPPDEFS += -Duse_LARGEFILE - endif + CPPDEFS += -Duse_LARGEFILE endif ifdef COVERAGE diff --git a/templates/ncrc-pgi.mk b/templates/ncrc-pgi.mk index d08c53e..f966a10 100644 --- a/templates/ncrc-pgi.mk +++ b/templates/ncrc-pgi.mk @@ -38,10 +38,6 @@ VERBOSE = # If non-blank, add additional verbosity compiler OPENMP = # If non-blank, compile with openmp enabled -NO_OVERRIDE_LIMITS = # If non-blank, do not use the -qoverride-limits - # compiler option. Default behavior is to compile - # with -qoverride-limits. - NETCDF = # If value is '3' and CPPDEFS contains # '-Duse_netCDF', then the additional cpp macro # '-Duse_LARGEFILE' is added to the CPPDEFS macro. @@ -49,10 +45,6 @@ NETCDF = # If value is '3' and CPPDEFS contains INCLUDES = # A list of -I Include directories to be added to the # the compile command. -SSE = # The SSE options to be used to compile. If blank, - # than use the default SSE settings for the host. - # Current default is to use SSE2. - COVERAGE = # Add the code coverage compile options. # Need to use at least GNU Make version 3.81 @@ -86,8 +78,14 @@ endif MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF -Duse_libMPI + +# Additional Preprocessor Macros needed due to Autotools and CMake +CPPDEFS += -DHAVE_GETTID -DHAVE_SCHED_GETAFFINITY + # Macro for Fortran preprocessor -FPPFLAGS = $(INCLUDES) +FPPFLAGS := $(INCLUDES) # Fortran Compiler flags for the NetCDF library FPPFLAGS += $(shell nf-config --fflags) @@ -105,7 +103,7 @@ FFLAGS_VERBOSE = -v -Minform=inform FFLAGS_COVERAGE = # Macro for C preprocessor -CPPFLAGS = $(INCLUDES) +CPPFLAGS := $(INCLUDES) # C Compiler flags for the NetCDF library CPPFLAGS += $(shell nc-config --cflags) @@ -124,8 +122,8 @@ CFLAGS_COVERAGE = # Optional Testing compile flags. Mutually exclusive from DEBUG, REPRO, and OPT # *_TEST will match the production if no new option(s) is(are) to be tested. -FFLAGS_TEST = $(FFLAGS_OPT) -CFLAGS_TEST = $(CFLAGS_OPT) +FFLAGS_TEST := $(FFLAGS_OPT) +CFLAGS_TEST := $(CFLAGS_OPT) # Linking flags LDFLAGS := -byteswapio @@ -157,15 +155,6 @@ FFLAGS += $(FFLAGS_OPENMP) LDFLAGS += $(LDFLAGS_OPENMP) endif -ifdef SSE -CFLAGS += $(SSE) -FFLAGS += $(SSE) -endif - -ifdef NO_OVERRIDE_LIMITS -FFLAGS += $(FFLAGS_OVERRIDE_LIMITS) -endif - ifdef VERBOSE CFLAGS += $(CFLAGS_VERBOSE) FFLAGS += $(FFLAGS_VERBOSE) diff --git a/templates/osx-gnu.mk b/templates/osx-gnu.mk index 64b1495..6be1067 100644 --- a/templates/osx-gnu.mk +++ b/templates/osx-gnu.mk @@ -79,6 +79,11 @@ endif # Get number of CPUs MAKEFLAGS += --jobs=$(shell sysctl -n hw.ncpu) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF + +# Additional Preprocessor Macros needed due to Autotools and CMake + # Macro for Fortran preprocessor FPPFLAGS := $(INCLUDES) diff --git a/templates/triton-gnu.mk b/templates/triton-gnu.mk index 1b1d1bf..965db5f 100644 --- a/templates/triton-gnu.mk +++ b/templates/triton-gnu.mk @@ -17,6 +17,12 @@ OPENMP = MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l) +# Required Preprocessor Macros: +CPPDEFS += -Duse_netCDF + +# Additional Preprocessor Macros needed due to Autotools and CMake +CPPDEFS += -DHAVE_GETTID -DHAVE_SCHED_GETAFFINITY + FPPFLAGS := FFLAGS :=-fcray-pointer -fdefault-double-8 -fdefault-real-8 -Waliasing -ffree-line-length-none -fno-range-check