Makefile.tmpl 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #adapted from runoff-mapper Makefile template
  2. FC = [[[PLT:ACTIVE:FC]]]
  3. FFLAGS = [[[PLT:ACTIVE:FFLAGS]]]
  4. LD = [[[PLT:ACTIVE:LD]]]
  5. LDFLAGS = [[[PLT:ACTIVE:LDFLAGS]]]
  6. FPP = [[[PLT:ACTIVE:FPP]]]
  7. FFLAGS_FPP_PREFIX = [[[PLT:ACTIVE:FFLAGS_FPP_PREFIX]]]
  8. OASIS_BASE_DIR = [[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]/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 := [[[PLT:ACTIVE:MPI_BASE_DIR]]]
  14. ifneq ($(strip $(MPI_BASE_DIR)),)
  15. MPI_INC_DIR := $(MPI_BASE_DIR)$(addprefix /,[[[PLT:ACTIVE:MPI_INC_SUBDIR]]])
  16. MPI_LIB_DIR := $(MPI_BASE_DIR)$(addprefix /,[[[PLT:ACTIVE:MPI_LIB_SUBDIR]]])
  17. endif
  18. MPI_LIBS := [[[PLT:ACTIVE:MPI_LIBS_WITHOUT_L]]]
  19. ifneq ($(strip [[[PLT:ACTIVE:NETCDF_BASE_DIR]]]),)
  20. NETCDF_LIB_DIR := [[[PLT:ACTIVE:NETCDF_BASE_DIR]]]/[[[PLT:ACTIVE:NETCDF_LIB_SUBDIR]]]
  21. NETCDF_INC_DIR := [[[PLT:ACTIVE:NETCDF_BASE_DIR]]]/[[[PLT:ACTIVE:NETCDF_INC_SUBDIR]]]
  22. endif
  23. NETCDF_LIBS := [[[PLT:ACTIVE:NETCDF_LIBS_WITHOUT_L]]]
  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