[4775] | 1 | ############################################################################## |
---|
| 2 | #This is the top makefile for compiling OASIS3-MCT coupling library including |
---|
| 3 | # mct/mpeu, scrip and psmile (i.e. interpolation and communication) |
---|
| 4 | #Platform dependent settings, compiler options, cpp keys, |
---|
| 5 | #paths and other stuff has to be set in an include file indicated in make.inc. |
---|
| 6 | # |
---|
| 7 | # default : mct/mpeu, scrip and psmile |
---|
| 8 | # oasis3_psmile (for OASIS3 upward compatibility): mct/mpeu, scrip and psmile |
---|
| 9 | # realclean : Automatic recompilation of all sources |
---|
| 10 | # |
---|
| 11 | ####### |
---|
| 12 | include make.inc |
---|
| 13 | # |
---|
| 14 | SHELL = /bin/sh |
---|
| 15 | MAKEf = $(MAKE) -f TopMakefileOasis3 |
---|
| 16 | # |
---|
| 17 | # Defining path for FORTRAN and C sources |
---|
| 18 | LIBSRC = $(COUPLE)/lib |
---|
| 19 | # |
---|
| 20 | # Log and error files for compiling |
---|
| 21 | LOG = $(COUPLE)/util/make_dir/COMP.log |
---|
| 22 | ERR = $(COUPLE)/util/make_dir/COMP.err |
---|
| 23 | # |
---|
| 24 | ####### |
---|
| 25 | default: |
---|
| 26 | rm -f $(LOG) $(ERR) |
---|
| 27 | $(MAKEf) makedirs |
---|
| 28 | $(MAKEf) makemct |
---|
| 29 | $(MAKEf) makelibs |
---|
| 30 | $(MAKEf) makepsmile |
---|
| 31 | # |
---|
| 32 | oasis3_psmile: |
---|
| 33 | rm -f $(LOG) $(ERR) |
---|
| 34 | $(MAKEf) makedirs |
---|
| 35 | $(MAKEf) makemct |
---|
| 36 | $(MAKEf) makelibs |
---|
| 37 | $(MAKEf) makepsmile |
---|
| 38 | # |
---|
| 39 | realclean: |
---|
| 40 | $(MAKEf) cleanlibs |
---|
| 41 | # |
---|
| 42 | # Rules for creating build and library directories |
---|
| 43 | # |
---|
| 44 | makedirs: |
---|
| 45 | @mkdir -p $(ARCHDIR)/build/lib/scrip |
---|
| 46 | @mkdir -p $(ARCHDIR)/build/lib/mctdir |
---|
| 47 | @mkdir -p $(ARCHDIR)/build/lib/mct |
---|
| 48 | @mkdir -p $(ARCHDIR)/build/lib/psmile.$(CHAN) |
---|
| 49 | @mkdir -p $(ARCHDIR)/lib |
---|
| 50 | # |
---|
| 51 | # Rules for compiling mpeu/mct library |
---|
| 52 | # |
---|
| 53 | makemct: |
---|
| 54 | @echo "=> Compiling library mpeu and mct" |
---|
| 55 | (cd $(ARCHDIR)/build/lib/mctdir; cp -f -r -p $(LIBSRC)/mct/* .;\ |
---|
| 56 | ./configure MPIFC="$(F90)" FC="$(F90)" CC="$(CC)" \ |
---|
| 57 | 1>> $(LOG) 2>> $(ERR) ;\ |
---|
| 58 | $(MAKE) 1>> $(LOG) 2>> $(ERR) ; \ |
---|
| 59 | cp -f ./*/lib*.a $(ARCHDIR)/lib/; \ |
---|
| 60 | cp -f ./*/*.o $(ARCHDIR)/build/lib/mct/; \ |
---|
| 61 | cp -f ./*/*.mod $(ARCHDIR)/build/lib/mct/;) |
---|
| 62 | # |
---|
| 63 | # Rules for compiling the libraries scrip and psmile |
---|
| 64 | # |
---|
| 65 | makelibs: |
---|
| 66 | @echo "=> Compiling library scrip" |
---|
| 67 | (cd $(ARCHDIR)/build/lib/scrip; cp -f $(LIBSRC)/scrip/src/Makefile .;\ |
---|
| 68 | $(modifmakefile) ; $(MAKE) all 1>> $(LOG) 2>> $(ERR) ) |
---|
| 69 | |
---|
| 70 | makepsmile: |
---|
| 71 | @echo "=> Compiling library psmile" |
---|
| 72 | (cd $(ARCHDIR)/build/lib/psmile.$(CHAN) ; \ |
---|
| 73 | cp -f $(LIBSRC)/psmile/src/Makefile . ; $(modifmakefile) ; \ |
---|
| 74 | $(MAKE) all 1>> $(LOG) 2>> $(ERR) ) |
---|
| 75 | # |
---|
| 76 | # Rules for cleaning |
---|
| 77 | # |
---|
| 78 | cleanlibs: |
---|
| 79 | @echo cleaning oasis3-mct libraries |
---|
| 80 | rm -f $(ARCHDIR)/build/lib/scrip/* |
---|
| 81 | rm -f $(ARCHDIR)/build/lib/mct/* |
---|
| 82 | rm -f -r $(ARCHDIR)/build/lib/mctdir/* |
---|
| 83 | rm -f $(ARCHDIR)/build/lib/psmile.$(CHAN)/* |
---|
| 84 | rm -f $(ARCHDIR)/lib/libscrip.a |
---|
| 85 | rm -f $(ARCHDIR)/lib/libmct.a |
---|
| 86 | rm -f $(ARCHDIR)/lib/libmpeu.a |
---|
| 87 | rm -f $(ARCHDIR)/lib/libpsmile.$(CHAN).a |
---|
| 88 | # |
---|
| 89 | ## Some rules to modify/add variables in makefiles |
---|
| 90 | # |
---|
| 91 | modifmakefile = ( echo 'include $(COUPLE)/util/make_dir/make.inc' \ |
---|
| 92 | > infile; cat Makefile >> infile ; cp -f infile Makefile ) |
---|
| 93 | # |
---|
| 94 | ######################################################################################## |
---|