Skip to content

Commit

Permalink
Add CPPDEFS used in autotools to templates (#28)
Browse files Browse the repository at this point in the history
Added flags that are used in FMS with autotools to allow users to continue using mkmf after the addition of autotools.
  • Loading branch information
underwoo authored Jan 13, 2020
1 parent 1a60b1a commit f821c5f
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 85 deletions.
12 changes: 9 additions & 3 deletions templates/linux-gnu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 :=
Expand Down
6 changes: 6 additions & 0 deletions templates/linux-intel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions templates/linux-ubuntu-trusty-gnu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions templates/linux-ubuntu-xenial-gnu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions templates/macOS-gnu8-mpich3.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions templates/nccs-intel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 11 additions & 24 deletions templates/ncrc-cray.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,13 @@ 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.

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
Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
35 changes: 11 additions & 24 deletions templates/ncrc-gnu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,13 @@ 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.

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
Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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 :=
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
30 changes: 17 additions & 13 deletions templates/ncrc-intel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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 :=
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit f821c5f

Please sign in to comment.