Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,13 @@ R-utils/read.q.quick.r
#Xiangtao Ignores
ED/build/ed2_gfortran
ED/build/ed2_ifort
#Include.mk ignores (and exceptions)
ED/build/make/include.mk.*
!ED/build/make/include.mk.docker.gnu
!ED/build/make/include.mk.docker.intel
!ED/build/make/include.mk.gnu
!ED/build/make/include.mk.intel
!ED/build/make/include.mk.macos
!ED/build/make/include.mk.pgi
!ED/build/make/include.mk.travisci

88 changes: 83 additions & 5 deletions ED/build/make/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,96 @@ ifeq ($(F_LOWO_OPTS),)
endif
#------------------------------------------------------------------------------------------#

ifeq ($(OPT),"dbg")
INCLUDES = ""


#------------------------------------------------------------------------------------------#
# Make variables CMACH and FC_TYPE are correctly set. #
#------------------------------------------------------------------------------------------#
FATAL_ERROR=0
ifeq ($(CMACH),)
CMACH_ERROR=1
FATAL_ERROR=1
else ifeq ($(CMACH),$(filter $(CMACH), LINUX MACOS DOCKER CINTEG))
CMACH_ERROR=0

ifeq ($(FC_TYPE),$(filter $(FC_TYPE), GNU INTEL PGI))
FCTYPE_ERROR=0
else
FCTYPE_ERROR=1
FATAL_ERROR=1
endif
else
CMACH_ERROR=1
FATAL_ERROR=1
endif
#------------------------------------------------------------------------------------------#


#------------------------------------------------------------------------------------------#
# Gracefully fail if CMACH and FC_TYPE are not correctly set. This will allow users to #
# make sure they selected a supported version. #
#------------------------------------------------------------------------------------------#
ifeq ($(CMACH_ERROR),1)
@echo ""
@echo "---~---"
@echo " FATAL ERROR!"
@echo "---~---"
@echo " Variable CMACH is either not defined or has an invalid value in your"
@echo " include.mk.[PLATFORM]. Please set to one of the following values"
@echo ""
@echo " CMACH=LINUX (For Linux machines)"
@echo " CMACH=MACOS (For MacOS machines)"
@echo ""
@echo " It is possible to set CMACH to DOCKER and CINTEG, but these are special and"
@echo " specific cases and should not be used unless you are working on these specific"
@echo " cases."
@echo "---~---"
@echo ""
endif
ifeq ($(FCTYPE_ERROR),1)
@echo ""
@echo "---~---"
@echo " FATAL ERROR!"
@echo "---~---"
@echo " Variable FC_TYPE is either not defined or has an invalid value in your"
@echo " include.mk.[PLATFORM]. Please set to one of the following values"
@echo ""
@echo " FC_TYPE=GNU # To compile ED2 with gfortran/gcc"
@echo " FC_TYPE=INTEL # To compile ED2 with ifx/icx (or ifort/icc in older systems)"
@echo " FC_TYPE=PGI # To compile ED2 with pgfortran/pgcc"
@echo ""
@echo " New types may be added in the future (feel free to contribute with other"
@echo " compilers)."
@echo "---~---"
@echo ""
endif
ifeq ($(FATAL_ERROR),1)
$(error CMACH and/or FC_TYPE are not properly set in your include.mk.[PLATFORM] file.)"
endif
#------------------------------------------------------------------------------------------#



#----- Set parallel flag based on the settings. -------------------------------------------#
ifeq ($(F_COMP),$(filter $(F_COMP), mpif90 mpifortran))
PAR_DEFS=-DRAMS_MPI
else ifdef $(PAR_LIBS)
PAR_DEFS=-DRAMS_MPI
else
PAR_DEFS=
endif
#------------------------------------------------------------------------------------------#



#----- Compiler commands. -----------------------------------------------------------------#
INCLUDES = $(PAR_INCS) -I$(ED_INCS) $(HDF5_INCS) $(MPI_INCS) $(LAPACK_INCS)
F90_COMMAND = $(F_COMP) -c $(F_OPTS) $(INCLUDES) $(PAR_DEFS)
F90_LOWO_COMMAND = $(F_COMP) -c $(F_LOWO_OPTS) $(INCLUDES) $(PAR_DEFS)
FPP_COMMAND = $(F_COMP) -c -DUSE_INTERF=$(USE_INTERF) -DUSENC=$(USENC) -D$(CMACH) \
-D$(FC_TYPE) -DUSE_COLLECTIVE_MPIO=$(USE_COLLECTIVE_MPIO) \
FPP_COMMAND = $(F_COMP) -c -D$(CMACH) -D$(FC_TYPE) \
-DUSE_COLLECTIVE_MPIO=$(USE_COLLECTIVE_MPIO) \
-DUSE_MPIWTIME=$(USE_MPIWTIME) $(F_OPTS) $(INCLUDES) $(PAR_DEFS)
FPP_LOWO_COMMAND = $(F_COMP) -c -DUSE_INTERF=$(USE_INTERF) -DUSENC=$(USENC) -D$(CMACH) \
FPP_LOWO_COMMAND = $(F_COMP) -c -D$(CMACH) -D$(FC_TYPE) \
-DUSE_COLLECTIVE_MPIO=$(USE_COLLECTIVE_MPIO) \
-DUSE_MPIWTIME=$(USE_MPIWTIME) $(F_LOWO_OPTS) $(INCLUDES) $(PAR_DEFS)
CXX_COMMAND = $(C_COMP) -c $(C_OPTS) -D$(CMACH) $(HDF5_INCS) $(INCLUDES) $(PAR_DEFS)
Expand Down
Loading
Loading