New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Makefile in trunk/NVTK – NEMO

source: trunk/NVTK/Makefile @ 1305

Last change on this file since 1305 was 1302, checked in by ctlod, 15 years ago

correct minor bugs, see ticket: #240

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 8.1 KB
Line 
1# $Id$
2#####################################################################
3# Author : Claude Talandier for NEMO team
4# Contact : nemo_st@locean-ipsl.upmc.fr
5#
6# VARS TO SET: 6 + 1 (optional)
7#     - NAM_V      : name of the current test
8#     - LISTE_CONF : configurations name (ORCA2_LIM, GYRE ...)
9#     - JOBS_2LAUN : jobs to launch (nojob, all, long, short or gtime)
10#     - BUILD_MAKE : run type (mon, mpi ... )
11#     - MAK_TIME   : to perform a CPU time measure making a one year run
12#                    use key word 'timing' or 'notiming'
13#     - MAK_MEMO   : to perform a memory check
14#                    use key word 'memo' or 'nomemo'
15#     - REF_TAGV   : (optional) reference tag name. If specified,
16#                    current results will be compare to the results
17#                    of this tag (for a given configuration and run type)
18#
19# WORK: Allows to launch all the validation process, i.e.
20#     0.   build dependencies using: 'gmake -s dep'
21#     I.   launch compilation
22#     II.  launch simulation
23#     III. final report
24#
25#####################################################################
26SHELL = /bin/ksh
27#####################################################################
28##### Begin Users modifications
29#####################################################################
30#-
31#- Name of the test
32NAM_V = MY_EXP1
33#-
34#- Configurations list which must be tested
35LISTE_CONF = GYRE GYRE_LOBSTER ORCA2_LIM
36#-
37#- Jobs to launch use keyword: nojob, all, long, short or gtime
38JOBS_2LAUN = all
39#-
40#- Compilation list type to perform, mon (mono) &/or mpi &/or omp (Open-MP)
41BUILD_MAKE =  mon mpi
42#-
43#- Proceed to a timing, use key word 'timing' or 'notiming'
44MAK_TIME = notiming
45#-
46#- Proceed to a memory check, use key word 'memo' or 'nomemo'
47MAK_MEMO = memo
48#-
49#- Reference Tag version
50REF_TAGV = nemo_v2_3
51#-
52#####################################################################
53##### End Users modifications
54#####################################################################
55
56##
57all: $(LISTE_CONF)
58   @echo '      '
59   @echo '             ----->>>>>>>>>   Compilation process ended for configuration(s) :' $(LISTE_CONF)
60   @echo '      '
61
62#- Make good links & launch the compilation process
63$(LISTE_CONF):
64   @echo
65   @echo "CONFIGURATION :" $@
66   @( MYREP_LIST=`(cd 2TEST ; ls *.[Ffh]90 )` ; \
67          cd ../$@/MY_SRC ; rm -rf *.[Ffh]90 ; if [ -n "$$MYREP_LIST" ] ; \
68        then ln -sf ../../NVTK/2TEST/*.[Ffh]90 . ; fi ; ) 
69   @echo "test=" $(NAM_V) > ../$@/specifs.txt
70   @echo "runs=" $(BUILD_MAKE) >> ../$@/specifs.txt
71   @echo "time=" $(MAK_TIME) >> ../$@/specifs.txt
72   @echo "memo=" $(MAK_MEMO) >> ../$@/specifs.txt
73   @echo "tagname=" $(REF_TAGV) >> ../$@/specifs.txt
74   @echo `svn info ../../modeles/NEMO | grep URL` >> ../$@/specifs.txt
75   @echo `svn info ../../modeles/NEMO | grep Revision ` >> ../$@/specifs.txt
76   @( LSFILES=`(cd 2TEST ; ls *.[Ffh]90 )` ; if [ -n "$$LSFILES" ] ; \
77     then echo $$LSFILES > ../$@/f2test.txt ; else rm -f ../$@/f2test.txt ; \
78          touch ../$@/f2test.txt ; fi ; )
79   @echo
80   @echo '             ----->>>>>>>>>   Links from NVTK/2TEST to '$@/MY_SRC 'done'
81   @echo
82   @echo '                              Build the Makefile for' $@ 'configuration'
83   @../../util/ins_make -w $@
84   @echo
85   @echo
86   @gmake -C ../$@ RUN='$(BUILD_MAKE)' JOB=$(JOBS_2LAUN) RTG=$(REF_TAGV) MKTE=$(MAK_TIME) MKMO=$(MAK_MEMO) REXP=$(NAM_V) -j 2 > $@_step.txt
87
88#- Rebuild dependencies when new cpp key and/or new module used
89dep: clear
90   for conf in ${LISTE_CONF}; do \
91       echo ; \
92       echo ; \
93       echo ; \
94       echo '             ----->>>>>>>>> Rebuild dependencies for the' $$conf 'configuration' ; \
95       echo ; \
96       echo '                          > Build links from 2TEST to '$$conf'/MY_SRC directory :' ; \
97       echo ; \
98       MYREP_LIST=`(cd 2TEST ; ls *.[Ffh]90 )` ; \
99            cd ../$$conf/MY_SRC ; rm -rf *.[Ffh]90 ; \
100            if [ -n "$$MYREP_LIST" ] ; \
101            then for F in $$MYREP_LIST; do \
102            echo "                             # link from 2TEST to "$$conf"/MY_SRC/$$F" ; \
103                   ln -sf  ../../NVTK/2TEST/$$F . ; \
104                done ; fi ; \
105       echo ; \
106       echo ; \
107       echo '                          > Rebuild links in the '$$conf'/WORK directory:' ; \
108       echo ; \
109            cd ../WORK ; \
110       rm -rf `ls | fgrep -v -f .patron` ; \
111       check=`grep OPA_SRC .config`              ; \
112       if [ -n "$$check" ] ; then                   \
113           echo "                             # use OPA_SRC component files"                ; \
114           ln -sf ../../../modeles/NEMO/OPA_SRC/*.[Ffh]90          . ; \
115           ln -sf ../../../modeles/NEMO/OPA_SRC/*/*.[Ffh]90      . ; \
116            fi ; \
117       check=`grep LIM_SRC_2 .config`              ; \
118       if [ -n "$$check" ] ; then                   \
119           echo "                             # use LIM_SRC_2 component files"                ; \
120                ln -sf ../../../modeles/NEMO/LIM_SRC_2/*.[Ffh]90          . ; \
121            fi ; \
122       check=`grep LIM_SRC_3 .config`              ; \
123       if [ -n "$$check" ] ; then                   \
124           echo "                             # use LIM_SRC_3 component files"                ; \
125                ln -sf ../../../modeles/NEMO/LIM_SRC_3/*.[Ffh]90          . ; \
126            fi ; \
127       check=`grep NST_SRC .config`              ; \
128       if [ -n "$$check" ] ; then                   \
129           echo "                             # use NST_SRC component files"                ; \
130                \rm -rf agrif_opa_interp.F90           ; \
131                \rm -rf agrif_opa_sponge.F90           ; \
132                \rm -rf agrif_opa_update.F90           ; \
133                \rm -rf agrif_top_interp.F90           ; \
134                \rm -rf agrif_top_sponge.F90           ; \
135                \rm -rf agrif_top_update.F90           ; \
136                ln -sf ../../../modeles/NEMO/NST_SRC/*.[Ffh]90      .     ; \
137            fi ; \
138       check=`grep C1D_SRC .config`              ; \
139       if [ -n "$$check" ] ; then                   \
140           echo "                             # use C1D_SRC component files"                ; \
141                ln -sf ../../../modeles/NEMO/C1D_SRC/*.[Ffh]90          . ; \
142            fi ; \
143       check=`grep TOP_SRC .config`              ; \
144       if [ -n "$$check" ] ; then  \
145           echo "                             # use TOP_SRC component files"                ; \
146                \rm -rf trcstp.F90                      ; \
147                \rm -rf sms.F90                         ; \
148                \rm -rf trcini.F90                      ; \
149                ln -sf ../../../modeles/NEMO/TOP_SRC/*.[Ffh]90          . ; \
150                ln -sf ../../../modeles/NEMO/TOP_SRC/*/*.[Ffh]90      . ; \
151            fi ; \
152       check=`grep OFF_SRC .config`              ; \
153       if [ -n "$$check" ] ; then                   \
154           echo "                             # use OFF_SRC component files"                ; \
155                ln -sf ../../../modeles/NEMO/OFF_SRC/*.[Ffh]90          . ; \
156                ln -sf ../../../modeles/NEMO/OFF_SRC/*/*.[Ffh]90        . ; \
157            fi ; \
158       mn=`awk '{ print $$1 }' .config `  ; \
159            myrep=../../../config/$$mn/MY_SRC ; \
160       echo "                             # use MY_SRC component files"                ; \
161            for i in `ls $$myrep` ; do \
162              [ -f $$i ] && \rm -rf $$i ;\
163            done ; \
164            myrep_list=`(cd $$myrep ; ls *.[Ffh]90 )` ; \
165            if [ -n "$$myrep_list" ] ; then \
166                for F in $$myrep_list; do \
167                   ln -sf  $$myrep/$$F . ; \
168                done ; \
169            fi ; \
170            cd .. ; ../NVTK/fait_AA_make ; \
171       echo ; \
172       echo "                             #################################" ;\
173       echo "                             Dependencies for" $$conf "ready" ;\
174       echo "                             #################################" ;\
175       echo ;\
176            cd ../NVTK ; \
177        done 
178   @echo
179   @echo "                             ##################################################" 
180   @echo "                             Launch the compilation and job process using gmake" 
181   @echo "                             ##################################################"
182   @echo
183
184clear :
185   @echo
186   @echo
187   @clear
Note: See TracBrowser for help on using the repository browser.