CHOMBO_PATH = /groups/dark/nomahen/Chombo-3.1 #---------------------------------------------------------------------------- # Extract dimensionality from Flash.h. # The code in this section should not need to be modified. #---------------------------------------------------------------------------- _DIM := $(shell grep "define NDIM" Flash.h | cut -d " " -f 3) #---------------------------------------------------------------------------- # Extract Chombo build information from the Makefile at CHOMBO_PATH. # The code in this section should not need to be modified. #---------------------------------------------------------------------------- _MPI := $(shell make vars DIM=${_DIM} -C ${CHOMBO_PATH}/lib | \ awk -F 'MPICXX=' '/^MPICXX/{print $$2}') ifeq ($(strip $(_MPI)),) $(error "Chombo MPICXX variable is empty") endif _CPP := $(shell make vars DIM=${_DIM} -C ${CHOMBO_PATH}/lib | \ awk -F 'CPPFLAGS=' '/^CPPFLAGS/{print $$2}') _LIB := $(shell make vars DIM=${_DIM} -C ${CHOMBO_PATH}/lib | \ awk -F 'config=' '/^config/{print $$2}') _PHDF_INC := $(shell make vars DIM=${_DIM} -C ${CHOMBO_PATH}/lib | \ awk -F 'HDFMPIINCFLAGS=' '/^HDFMPIINCFLAGS/{print $$2}') _PHDF_LIB := $(shell make vars DIM=${_DIM} -C ${CHOMBO_PATH}/lib | \ awk -F 'HDFMPILIBFLAGS=' '/^HDFMPILIBFLAGS/{print $$2}') #---------------------------------------------------------------------------- # Use Chombo build information to get consistent macro values for the FLASH build. #---------------------------------------------------------------------------- # Use two passes of dirname to strip the bin/mpicxx MPI_PATH := $(shell dirname $(shell dirname $(shell which $(_MPI)))) HDF4_PATH = HDF5_PATH = HYPRE_PATH = /usr/local/hypre ZLIB_PATH = PAPI_PATH = PAPI_FLAGS = FISHPAK_PATH = NCMPI_PATH = /usr/local/netcd MPE_PATH = #---------------------------------------------------------------------------- # Compiler and linker commands # # Use the MPICH wrappers around the compilers -- these will automatically # load the proper libraries and include files. Version of MPICH prior # to 1.2.2 (?) do not recognize .F90 as a valid Fortran file extension. # You need to edit mpif90 and add .F90 to the test of filename extensions, # or upgrade your MPICH. #---------------------------------------------------------------------------- FCOMP = ${MPI_PATH}/bin/mpif90 CCOMP = ${MPI_PATH}/bin/mpicc CPPCOMP = ${MPI_PATH}/bin/mpicxx LINK = ${MPI_PATH}/bin/mpif90 # pre-processor flag PP = -D #---------------------------------------------------------------------------- # Compilation flags # # Three sets of compilation/linking flags are defined: one for optimized # code, one for testing, and one for debugging. The default is to use the # _OPT version. Specifying -debug to setup will pick the _DEBUG version, # these should enable bounds checking. Specifying _TEST is used for # flash_test, and is set for quick code generation, and (sometimes) # profiling. The Makefile generated by setup will assign the generic token # (ex. FFLAGS) to the proper set of flags (ex. FFLAGS_OPT). #---------------------------------------------------------------------------- OPENMP = -fopenmp FFLAGS_OPT = -ggdb -c -O2 -fdefault-real-8 -fdefault-double-8 \ -Wuninitialized #I explictly add -O0 because I found that compiling source files without #an optimization flag generates the same object code as compiling source #files with -O2. The -O0 is required so that gdb no longer shows #"" for certain function arguments. FFLAGS_DEBUG = -ggdb -c -O0 -fdefault-real-8 -fdefault-double-8 \ -pedantic -Wall -Waliasing \ -Wsurprising -Wconversion -Wunderflow \ -ffpe-trap=invalid,zero,overflow -fbounds-check \ -fimplicit-none -fstack-protector-all FFLAGS_TEST = -ggdb -c -O0 -fdefault-real-8 -fdefault-double-8 FFLAGS_HYPRE = -I${HYPRE_PATH}/include F90FLAGS = #The macro _FORTIFY_SOURCE adds some lightweight checks for buffer #overflows at both compile time and run time (only active at -O1 or higher) #http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html CFLAGS_OPT = -ggdb -c -O2 -Wuninitialized -D_FORTIFY_SOURCE=2 CFLAGS_DEBUG = -ggdb -c -O0 -Wno-div-by-zero -Wundef \ -Wconversion -Wstrict-prototypes -Wunreachable-code \ -pedantic -Wall -Winit-self -ftree-vrp -Wfloat-equal \ -Wunsafe-loop-optimizations -Wpadded -fstack-protector-all CFLAGS_TEST = -ggdb -O0 -c CFLAGS_HYPRE = -I${HYPRE_PATH}/include # if we are using HDF5, we need to specify the path to the include files CFLAGS_HDF5 = $(_PHDF_INC) #-I${HDF5_PATH}/include -DH5_USE_16_API CFLAGS_NCMPI = -I${NCMPI_PATH}/include # for chombo CFLAGS_CHOMBO = -I${CHOMBO_PATH}/lib/include ${_CPP} -DCH_LANG_CC #---------------------------------------------------------------------------- # Linker flags # # There is a seperate version of the linker flags for each of the _OPT, # _DEBUG, and _TEST cases. #---------------------------------------------------------------------------- LFLAGS_OPT = -ggdb -o LFLAGS_DEBUG = -ggdb -O0 -o LFLAGS_TEST = -ggdb -O0 -o #---------------------------------------------------------------------------- # Library specific linking # # If a FLASH module has a 'LIBRARY xxx' line in its Config file, we need to # create a macro in this Makefile.h for LIB_xxx, which will be added to the # link line when FLASH is built. This allows us to switch between different # (incompatible) libraries. We also create a _OPT, _DEBUG, and _TEST # library macro to add any performance-minded libraries (like fast math), # depending on how FLASH was setup. #---------------------------------------------------------------------------- LIB_OPT = LIB_DEBUG = LIB_TEST = LIB_CHOMBO = -L$(CHOMBO_PATH)/lib -lamrtimedependent${_LIB} -lamrtools${_LIB} -lboxtools${_LIB} -lbasetools${_LIB} -lstdc++ LIB_HDF4 = LIB_HDF5 = $(_PHDF_LIB)# -lz LIB_PAPI = LIB_MATH = LIB_MPI = LIB_NCMPI = -L ${NCMPI_PATH}/lib -lpnetcdf LIB_MPE = LIB_HYPRE = -L${HYPRE_PATH}/lib -lHYPRE # Uncomment the following line to use electic fence memory debugger. # export EF_ALLOW_MALLOC_0=1 #CONFIG_LIB = -L/usr/lib64 -lefence #---------------------------------------------------------------------------- # Additional machine-dependent object files # # Add any machine specific files here -- they will be compiled and linked # when FLASH is built. #---------------------------------------------------------------------------- MACHOBJ = #---------------------------------------------------------------------------- # Additional commands #---------------------------------------------------------------------------- MV = mv -f AR = ar -r RM = rm -f CD = cd RL = ranlib ECHO = echo # CHOMBO shell commands #---------------------------------------------------------------------------- # Fake existence of iso_c_bindings module to prevent unnecessary recompilations. #---------------------------------------------------------------------------- ifeq ($(FLASHBINARY),true) iso_c_binding.mod : touch $@ endif # make chombo_vars will print macros to screen chombo_vars: @$(ECHO) "FLASH application has dimensionality:" $(_DIM) @$(ECHO) "Chombo MPI C++ compiler:" $(_MPI) @$(ECHO) "Chombo MPI path:" $(MPI_PATH) @$(ECHO) "Chombo include flags:" $(_CPP) @$(ECHO) "Chombo base library name:" $(_LIB) @$(ECHO) "Chombo Parallel HDF5 include flags:" $(_PHDF_INC) @$(ECHO) "Chombo Parallel HDF5 library flags:" $(_PHDF_LIB) @$(ECHO) "CFLAGS_CHOMBO:" $(CFLAGS_CHOMBO) @$(ECHO) "LIB_CHOMBO:" $(LIB_CHOMBO)