dmi-hpcdev-TopMakefileOasis3 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ##############################################################################
  2. #This is the top makefile for compiling OASIS3-MCT coupling library
  3. # withing the EC-Earth environment.
  4. #######
  5. include make.inc
  6. SHELL = /bin/sh
  7. MAKEf = $(MAKE) -f TopMakefileOasis3
  8. # Defining path for FORTRAN and C sources
  9. LIBSRC = $(COUPLE)/lib
  10. #######
  11. default:
  12. @$(MAKEf) makedirs
  13. @$(MAKEf) makemct
  14. @$(MAKEf) makelibs
  15. @$(MAKEf) makepsmile
  16. realclean:
  17. $(MAKEf) cleanlibs
  18. # Rules for creating build and library directories
  19. #
  20. makedirs:
  21. @mkdir -p $(ARCHDIR)/build/lib/scrip
  22. @mkdir -p $(ARCHDIR)/build/lib/mctdir
  23. @mkdir -p $(ARCHDIR)/build/lib/mct
  24. @mkdir -p $(ARCHDIR)/build/lib/psmile.$(CHAN)
  25. @mkdir -p $(ARCHDIR)/lib
  26. # Rules for compiling mpeu/mct library
  27. #
  28. makemct:
  29. @echo "==> Compiling library mpeu and mct"
  30. @(cd $(ARCHDIR)/build/lib/mctdir; \
  31. cp -f -r -p $(LIBSRC)/mct/* .; \
  32. ./configure --host=x86_64-linux-gnu MPIFC="$(F90)" FC="$(F90)" CC="$(CC)" CFLAGS="$(addprefix -I,$(MPI_INCLUDE))" FCFLAGS="$(addprefix -I,$(MPI_INCLUDE))"; \
  33. $(MAKE); \
  34. cp -f ./*/lib*.a $(ARCHDIR)/lib/; \
  35. cp -f ./*/*.o $(ARCHDIR)/build/lib/mct/; \
  36. cp -f ./*/*.mod $(ARCHDIR)/build/lib/mct/; )
  37. # Rules for compiling the libraries scrip and psmile
  38. #
  39. makelibs:
  40. @echo "==> Compiling library scrip"
  41. @(cd $(ARCHDIR)/build/lib/scrip; \
  42. cp -f $(LIBSRC)/scrip/src/Makefile .; \
  43. $(modifmakefile) ; \
  44. $(MAKE) all )
  45. makepsmile:
  46. @echo "==> Compiling library psmile"
  47. (cd $(ARCHDIR)/build/lib/psmile.$(CHAN); \
  48. cp -f $(LIBSRC)/psmile/src/Makefile .; \
  49. $(modifmakefile); \
  50. $(MAKE) all )
  51. # Rules for cleaning
  52. #
  53. cleanlibs:
  54. @echo "==> Cleaning OASIS3 libraries"
  55. @rm -f $(ARCHDIR)/build/lib/scrip/*
  56. @rm -f $(ARCHDIR)/build/lib/mct/*
  57. @rm -f -r $(ARCHDIR)/build/lib/mctdir/*
  58. @rm -f $(ARCHDIR)/build/lib/psmile.$(CHAN)/*
  59. @rm -f $(ARCHDIR)/lib/libscrip.a
  60. @rm -f $(ARCHDIR)/lib/libmct.a
  61. @rm -f $(ARCHDIR)/lib/libmpeu.a
  62. @rm -f $(ARCHDIR)/lib/libpsmile.$(CHAN).a
  63. ## Some rules to modify/add variables in makefiles
  64. #
  65. modifmakefile = ( echo 'include $(COUPLE)/util/make_dir/make.inc' \
  66. > infile; cat Makefile >> infile ; cp -f infile Makefile )
  67. #
  68. ########################################################################################