Created
April 30, 2020 16:14
-
-
Save JBlaschke/3b67d166d2e2c8cdf6b4dc7d09a5aca7 to your computer and use it in GitHub Desktop.
AMReX make configuration for using homebrew-installed gcc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# AMReX Make configuration for Homebrew | |
# | |
# If it exists, the Make.local file is included at the end of Make.defs. Thus | |
# one can override various variables here. | |
# | |
# Do not check this file into git repo. This is supposed to be purely local. | |
# | |
# | |
# Wrappers for C++, C and Fortran compilers. | |
# | |
# NOTE: Homebrew installs newer versions for gcc with major version number in | |
# the compilre exec name (to prevent name collisions) | |
CXX = g++-9 | |
CC = gcc-9 | |
FC = gfortran-9 | |
F90 = gfortran-9 | |
# If you want to use the mpi compiler wrappers instead -- NOTE: this migh use | |
# apple clang (and not Homebrew installed llvm) which never causes problems | |
# because apple never breaks any standards *sarcasm* | |
#CXX := mpicxx | |
#CC := mpicc | |
#FC := mpif90 | |
#F90 := mpif90 | |
# | |
# Libraries | |
# | |
# AMReX uses MPI in both C++ and Fortran. Because CXX is used for linking, you | |
# MAY need to provide path to MPI Fortran library. | |
#LIBRARIES += -lmpif90 | |
# If you're using Homebrew, you'll need to manually add /usr/local to the | |
# compilers search path | |
INCLUDE_LOCATIONS += /usr/local/include | |
LIBRARY_LOCATIONS += /usr/local/lib | |
# macOS Mojave canned the /usr/include directory. We now have to use the Xcode | |
# commandline tools for things like unistd.h | |
#INCLUDE_LOCATIONS += /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include | |
#LIBRARY_LOCATIONS += /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib | |
# If you're using FFTW, you can keep that here | |
FFTW_DIR :=/usr/local/Cellar/fftw-mpich/3.3.8_1/lib | |
# | |
# Other compiler flags | |
# | |
# When I run on my local desktop, I like to add this gfortran flag. | |
FFLAGS += -fcheck=array-temps | |
F90FLAGS += -fcheck=array-temps | |
# Instead of linking to static gfortran library, I like to use shared | |
# libraries. | |
gfortran_libso_dir := $(dir $(shell $(F90) -print-file-name=libgfortran.so)) | |
LIBRARY_LOCATIONS += $(gfortran_libso_dir) | |
gfortran_lib = -lgfortran | |
quadmath_lib = -lquadmath | |
# `make print-CXXFLAGS` shows "-O0" is used. I would like to replace it with | |
# "-O2". Note that `:=` is needed to avoid recursive references. | |
CXXFLAGS := $(subst -O0,-O2,$(CXXFLAGS)) | |
# Replace old C++ standard... | |
CXXFLAGS := $(subst -std=c++11,-std=c++14,$(CXXFLAGS)) | |
# If This compiler has a bug. I might have to remove an option from CXXFLAGS. | |
# The variable lowercase_comp is defined in Make.defs and it's the lower case | |
# version of $COMP. Note that we are moving toward C++11/14. So disabling | |
# C++11 is not an option. This is just an example. | |
#ifeq ($(lowercase_comp),pg?compiler) | |
# CXXFLAGS := $(filter-out --c++11,$(CXXFLAGS)) | |
#endif | |
# CXXFLAGS += -stdlib=libc++ -isystem | |
# | |
# Other settings used by AMReX's build system | |
# | |
# Always have verbosity on even if GNUmakefile set it to FALSE. | |
VERBOSE=TRUE | |
# By default ccache is not used unless USE_CCACHE is TRUE. But I want the | |
# opposite. That is ccache is used by default unless USE_CCACHE is FALSE. But | |
# if I am using UPC++, I would like to turn ccache off. | |
#ifeq ($(USE_CCACHE),FALSE) | |
# CCACHE = | |
#else ifeq ($(USE_UPCXX),TRUE) | |
# CCACHE = | |
#else | |
# CCACHE = ccache | |
#endif | |
# Maybe AMReX fails to configure makefile for MPI on your machine. You could | |
# set MPI stuff here, and then compile with NO_MPI_CHECKING=TRUE to tell AMReX | |
# not to check MPI stuff. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment