Skip to content

Commit

Permalink
Workaround for gfortran not adding -D__APPLE__ (#25)
Browse files Browse the repository at this point in the history
Gfortran on Mac OS X does not add the __APPLE__ macro.  Updated the two Mac OS X templates to add this macro definition to the the Fortran preprocessor flags.
  • Loading branch information
underwoo authored Jul 11, 2019
1 parent 91235f8 commit 1342ed2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 7 additions & 2 deletions templates/macOS-gnu8-mpich3.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Template for the GNU Compiler on macOS
# Template for the GNU Compiler on macOS
# Tested on macOS Mojave (version 10.14.2), with gnu 8.2 and mpich 3.3
#
# Typical use with mkmf
Expand Down Expand Up @@ -81,11 +81,16 @@ $(error Options DEBUG and TEST cannot be used together)
endif
endif

# Get number of CPUs
# Get number of CPUs
#MAKEFLAGS += --jobs=$(shell grep '^processor' /proc/cpuinfo | wc -l)
MAKEFLAGS += --jobs=$(shell sysctl -n hw.ncpu)

# Macro for Fortran preprocessor
FPPFLAGS := $(INCLUDES)
# Add -D__APPLE__ for Fortran if on OSX (i.e. Darwin)
ifeq ($(shell uname -s),Darwin)
FPPFLAGS += -D__APPLE__
endif
# Fortran Compiler flags for the NetCDF library
FPPFLAGS += $(shell nf-config --fflags)
# Fortran Compiler flags for the MPICH MPI library
Expand Down
9 changes: 8 additions & 1 deletion templates/osx-gnu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# mkmf -t osx-gnu.mk -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include

############
# Commands Macors
# Commands Macros
FC = mpif90
CC = mpicc
CXX = mpicxx
Expand Down Expand Up @@ -76,10 +76,17 @@ $(error Options DEBUG and TEST cannot be used together)
endif
endif

# Get number of CPUs
MAKEFLAGS += --jobs=$(shell sysctl -n hw.ncpu)

# Macro for Fortran preprocessor
FPPFLAGS := $(INCLUDES)

# Add -D__APPLE__ for Fortran if on OSX (i.e. Darwin)
ifeq ($(shell uname -s),Darwin)
FPPFLAGS += -D__APPLE__
endif

# Fortran Compiler flags for the NetCDF library
FPPFLAGS += $(shell nf-config --fflags)

Expand Down

0 comments on commit 1342ed2

Please sign in to comment.