#adapted from runoff-mapper Makefile template FC = mpif90 FFLAGS = -O2 -fp-model precise -march=core-avx2 -r8 LD = mpif90 LDFLAGS = -O2 -fp-model precise -march=core-avx2 FPP = fpp FFLAGS_FPP_PREFIX = -D OASIS_BASE_DIR = ${HOME}/models/ecearth_3.3.4.2/sources/oasis3-mct/ecconf OASIS_MOD_DIR = $(OASIS_BASE_DIR)/build/lib/psmile.MPI1 OASIS_INC_DIR = $(OASIS_BASE_DIR)/lib/psmile/include OASIS_LIB_DIR = $(OASIS_BASE_DIR)/lib OASIS_LIBS = -lpsmile.MPI1 -lmct -lmpeu -lscrip MPI_BASE_DIR := ${EBROOTOPENMPI} ifneq ($(strip $(MPI_BASE_DIR)),) MPI_INC_DIR := $(MPI_BASE_DIR)$(addprefix /,include) MPI_LIB_DIR := $(MPI_BASE_DIR)$(addprefix /,lib) endif MPI_LIBS := mpi mpi_mpifh ifneq ($(strip ${EBROOTNETCDFMINFORTRAN}),) NETCDF_LIB_DIR := ${EBROOTNETCDFMINFORTRAN}/lib NETCDF_INC_DIR := ${EBROOTNETCDFMINFORTRAN}/include endif NETCDF_LIBS := netcdff netcdf all: lpjg_forcing ccycle_coupling # add any new lpjg_forcing_xxx here, currently only IFS forcing implemented lpjg_forcing: lpjg_forcing_ifs_T159 lpjg_forcing_ifs_T255 lpjg_forcing_ifs_T%: lpjg_forcing_ifs_T%.o $(LD) $(LDFLAGS) -o $@ $^ -L$(OASIS_LIB_DIR) $(OASIS_LIBS) \ $(addprefix -L,$(NETCDF_LIB_DIR)) $(addprefix -l,$(NETCDF_LIBS)) \ $(addprefix -L,$(MPI_LIB_DIR)) $(addprefix -l,$(MPI_LIBS)) lpjg_forcing_ifs_T159.f90: $(FPP) $(FFLAGS_FPP_PREFIX)IFS_RES_T159 lpjg_forcing_ifs.F90 > $@ lpjg_forcing_ifs_T255.f90: $(FPP) $(FFLAGS_FPP_PREFIX)IFS_RES_T255 lpjg_forcing_ifs.F90 > $@ ccycle_coupling: ccycle_coupling.o $(LD) $(LDFLAGS) -o $@ $^ -L$(OASIS_LIB_DIR) $(OASIS_LIBS) \ $(addprefix -L,$(NETCDF_LIB_DIR)) $(addprefix -l,$(NETCDF_LIBS)) \ $(addprefix -L,$(MPI_LIB_DIR)) $(addprefix -l,$(MPI_LIBS)) %.o: %.f90 $(FC) $(FFLAGS) -c -I$(OASIS_MOD_DIR) $(addprefix -I,$(NETCDF_INC_DIR)) $(addprefix -I,$(MPI_INC_DIR)) $< .PHONY: clean clean: @rm -f *.o *.mod lpjg_forcing_ifs_T*.f90 lpjg_forcing_ifs_T159 lpjg_forcing_ifs_T255 ccycle_coupling