Makefile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #adapted from runoff-mapper Makefile template
  2. FC = mpif90
  3. FFLAGS = -O2 -fp-model precise -march=core-avx2 -r8
  4. LD = mpif90
  5. LDFLAGS = -O2 -fp-model precise -march=core-avx2
  6. FPP = fpp
  7. FFLAGS_FPP_PREFIX = -D
  8. OASIS_BASE_DIR = ${HOME}/models/ecearth_3.3.4.2/sources/oasis3-mct/ecconf
  9. OASIS_MOD_DIR = $(OASIS_BASE_DIR)/build/lib/psmile.MPI1
  10. OASIS_INC_DIR = $(OASIS_BASE_DIR)/lib/psmile/include
  11. OASIS_LIB_DIR = $(OASIS_BASE_DIR)/lib
  12. OASIS_LIBS = -lpsmile.MPI1 -lmct -lmpeu -lscrip
  13. MPI_BASE_DIR := ${EBROOTOPENMPI}
  14. ifneq ($(strip $(MPI_BASE_DIR)),)
  15. MPI_INC_DIR := $(MPI_BASE_DIR)$(addprefix /,include)
  16. MPI_LIB_DIR := $(MPI_BASE_DIR)$(addprefix /,lib)
  17. endif
  18. MPI_LIBS := mpi mpi_mpifh
  19. ifneq ($(strip ${EBROOTNETCDFMINFORTRAN}),)
  20. NETCDF_LIB_DIR := ${EBROOTNETCDFMINFORTRAN}/lib
  21. NETCDF_INC_DIR := ${EBROOTNETCDFMINFORTRAN}/include
  22. endif
  23. NETCDF_LIBS := netcdff netcdf
  24. all: lpjg_forcing ccycle_coupling
  25. # add any new lpjg_forcing_xxx here, currently only IFS forcing implemented
  26. lpjg_forcing: lpjg_forcing_ifs_T159 lpjg_forcing_ifs_T255
  27. lpjg_forcing_ifs_T%: lpjg_forcing_ifs_T%.o
  28. $(LD) $(LDFLAGS) -o $@ $^ -L$(OASIS_LIB_DIR) $(OASIS_LIBS) \
  29. $(addprefix -L,$(NETCDF_LIB_DIR)) $(addprefix -l,$(NETCDF_LIBS)) \
  30. $(addprefix -L,$(MPI_LIB_DIR)) $(addprefix -l,$(MPI_LIBS))
  31. lpjg_forcing_ifs_T159.f90:
  32. $(FPP) $(FFLAGS_FPP_PREFIX)IFS_RES_T159 lpjg_forcing_ifs.F90 > $@
  33. lpjg_forcing_ifs_T255.f90:
  34. $(FPP) $(FFLAGS_FPP_PREFIX)IFS_RES_T255 lpjg_forcing_ifs.F90 > $@
  35. ccycle_coupling: ccycle_coupling.o
  36. $(LD) $(LDFLAGS) -o $@ $^ -L$(OASIS_LIB_DIR) $(OASIS_LIBS) \
  37. $(addprefix -L,$(NETCDF_LIB_DIR)) $(addprefix -l,$(NETCDF_LIBS)) \
  38. $(addprefix -L,$(MPI_LIB_DIR)) $(addprefix -l,$(MPI_LIBS))
  39. %.o: %.f90
  40. $(FC) $(FFLAGS) -c -I$(OASIS_MOD_DIR) $(addprefix -I,$(NETCDF_INC_DIR)) $(addprefix -I,$(MPI_INC_DIR)) $<
  41. .PHONY: clean
  42. clean:
  43. @rm -f *.o *.mod lpjg_forcing_ifs_T*.f90 lpjg_forcing_ifs_T159 lpjg_forcing_ifs_T255 ccycle_coupling