1 | #!/bin/bash |
---|
2 | |
---|
3 | #==============================================================================================================================\n |
---|
4 | # MODULE : makeorchidee_fcm |
---|
5 | # |
---|
6 | # CONTACT : orchidee-help _at_ ipsl.jussieu.fr |
---|
7 | # |
---|
8 | # LICENCE : IPSL (2006) |
---|
9 | # This software is governed by the CeCILL licence see ORCHIDEE/ORCHIDEE_CeCILL.LIC |
---|
10 | # |
---|
11 | # SVN : |
---|
12 | # $HeadURL: svn://forge.ipsl.jussieu.fr/orchidee/trunk/ORCHIDEE/makeorchidee_fcm $ |
---|
13 | # $Date: $ |
---|
14 | # $Revision: $ |
---|
15 | # \n |
---|
16 | #################################################################################################### |
---|
17 | # |
---|
18 | # This script has several possible functions : |
---|
19 | # 1. Compiling ORCHIDEE |
---|
20 | # 2. Building of the documentation |
---|
21 | # |
---|
22 | #*************************************************************************************************** |
---|
23 | # |
---|
24 | # Command lines : |
---|
25 | # |
---|
26 | # 1) makeorchidee_fcm [ -parallel PARALLEL_TYPE ] |
---|
27 | # [ -driver ] |
---|
28 | # [ -arch XXX ] |
---|
29 | # [ -prod | -dev | -debug ] |
---|
30 | # |
---|
31 | # 2) makeorchidee_fcm [ -clean ] |
---|
32 | # |
---|
33 | # 3) makeorchidee_fcm [ -doc | -doc_para ] ## actually doc_para is commented |
---|
34 | # [ -rmdoc ] |
---|
35 | # [ -doc_tree ] |
---|
36 | # |
---|
37 | |
---|
38 | ######################################################################## |
---|
39 | # |
---|
40 | # 1) Set default values. Some of them can be specified using environnement variables. |
---|
41 | # |
---|
42 | |
---|
43 | is_driver_opt=FALSE |
---|
44 | is_other_opt=FALSE |
---|
45 | clean=FALSE |
---|
46 | compile_flags="%PROD_FFLAGS" |
---|
47 | xios=FALSE |
---|
48 | full="" |
---|
49 | ext_src="" |
---|
50 | export P_P="" |
---|
51 | export SECTIONS_PARA="" |
---|
52 | ORCHDIR=`/bin/pwd` |
---|
53 | fcm_path=$ORCHDIR/tools/FCM_V1.2/bin |
---|
54 | compile_doc=FALSE |
---|
55 | |
---|
56 | # Following variables can be set as environement variables if wanted |
---|
57 | if [ -n "$FCM_ARCH" ]; then |
---|
58 | arch="$FCM_ARCH" |
---|
59 | else |
---|
60 | arch=NONE |
---|
61 | fi |
---|
62 | if [ -n "$FCM_PARA" ]; then |
---|
63 | parallel_mode="$FCM_PARA" |
---|
64 | else |
---|
65 | parallel_mode=seq |
---|
66 | fi |
---|
67 | if [ -n "$FCM_JOBS" ]; then |
---|
68 | job="$FCM_JOBS" |
---|
69 | else |
---|
70 | job=1 |
---|
71 | fi |
---|
72 | |
---|
73 | # Determine if also need to compile the OASIS driver. This is only the case if the |
---|
74 | # path for the libraries is provided and exists |
---|
75 | if [ -n "$OASIS_LIBDIR" ] ; then |
---|
76 | is_oasisdriver_opt=TRUE |
---|
77 | # Check also if the provided path also exist. If not, delete the option. |
---|
78 | if [ ! -d ${OASIS_LIBDIR} ]; then |
---|
79 | is_oasisdriver_opt=FALSE |
---|
80 | fi |
---|
81 | else |
---|
82 | is_oasisdriver_opt=FALSE |
---|
83 | fi |
---|
84 | |
---|
85 | |
---|
86 | ######################################################################### |
---|
87 | # 2. Read arguments |
---|
88 | # |
---|
89 | while (($# > 0)) ; do |
---|
90 | |
---|
91 | case $1 in |
---|
92 | "-h") |
---|
93 | print_help=TRUE ; shift ;; |
---|
94 | |
---|
95 | "-parallel") |
---|
96 | parallel_mode=$2 ; shift ; shift ;; |
---|
97 | |
---|
98 | "-p") |
---|
99 | parallel_mode=$2 ; shift ; shift ;; |
---|
100 | |
---|
101 | "-driver") |
---|
102 | is_driver_opt=TRUE ; shift ;; |
---|
103 | |
---|
104 | "-otherexec") |
---|
105 | is_other_opt=TRUE |
---|
106 | is_driver_opt=TRUE ; shift ;; |
---|
107 | |
---|
108 | "-arch") |
---|
109 | arch="$2" ; shift ; shift ;; |
---|
110 | |
---|
111 | "-xios") |
---|
112 | xios=TRUE |
---|
113 | shift ;; |
---|
114 | |
---|
115 | "-xios2") |
---|
116 | xios=TRUE |
---|
117 | shift ;; |
---|
118 | |
---|
119 | "-noxios") |
---|
120 | xios=FALSE |
---|
121 | shift ;; |
---|
122 | |
---|
123 | "-prod") |
---|
124 | compile_flags="%PROD_FFLAGS" ; shift ;; |
---|
125 | |
---|
126 | "-dev") |
---|
127 | compile_flags="%DEV_FFLAGS" ; shift ;; |
---|
128 | |
---|
129 | "-debug") |
---|
130 | compile_flags="%DEBUG_FFLAGS" ; shift ;; |
---|
131 | |
---|
132 | "-j") |
---|
133 | job="$2" ; shift ; shift ;; |
---|
134 | |
---|
135 | "-full") |
---|
136 | full='-full' ; shift ;; |
---|
137 | |
---|
138 | "-clean") |
---|
139 | clean=TRUE ; shift ;; |
---|
140 | |
---|
141 | "-ext_src") |
---|
142 | ext_src=$2 ; shift ; shift ;; |
---|
143 | |
---|
144 | # "-doc_para") |
---|
145 | # setenv P_P -DCPP_PARA |
---|
146 | # setenv SECTIONS_PARA "-e s&ENABLED_SECTIONS\ *= &ENABLED_SECTIONS = CPP_PARA&g" |
---|
147 | # goto doc |
---|
148 | |
---|
149 | "-doc") |
---|
150 | compile_doc=TRUE ; shift ;; |
---|
151 | |
---|
152 | "-rmdoc") |
---|
153 | \rm -rf docs |
---|
154 | shift ;; |
---|
155 | |
---|
156 | "-doc_tree") |
---|
157 | cd .. |
---|
158 | find ORCHIDEE \( -not -path '*.svn*' \ |
---|
159 | -a \( -name '*.f90' -o -name "*.F90" -o -name "*.h" \) \) \ |
---|
160 | -exec bash -c 'mkdir -p ORCHIDEE/DOC/$( dirname {} )/$( echo $( basename {} ) | sed -e "s/\..*//" )' \; |
---|
161 | cd ORCHIDEE |
---|
162 | shift ;; |
---|
163 | |
---|
164 | *) |
---|
165 | echo "unknown option "$1" , exiting..." |
---|
166 | exit |
---|
167 | esac |
---|
168 | done |
---|
169 | |
---|
170 | ######################################################################### |
---|
171 | # 3. Print help documentation and exit |
---|
172 | # |
---|
173 | if [[ "$print_help" == "TRUE" ]] ; then |
---|
174 | cat <<fin |
---|
175 | |
---|
176 | ######################################################################## |
---|
177 | # Usage of the script makeorchidee_fcm |
---|
178 | # |
---|
179 | # makeorchidee_fcm compiles ORCHIDEE using the Fcm a software developed |
---|
180 | # by the Hadley Centre. Fcm is stored in tools directory. |
---|
181 | # Platform specific compile options are found in the arch directory. |
---|
182 | ######################################################################## |
---|
183 | |
---|
184 | ./makeorchidee_fcm [Options] |
---|
185 | |
---|
186 | Main options |
---|
187 | [ -h ] : show this help |
---|
188 | |
---|
189 | [ -arch XXX ] : name of the archicture file containg platform dependent compile options. |
---|
190 | The files arch/arch-XXX.fcm and arch/arch-XXX.path must exist. |
---|
191 | |
---|
192 | [ -parallel|-p PARALLEL_TYPE ] : choose parallelization mode for ORCHIDEE : |
---|
193 | PARALLEL_TYPE = |
---|
194 | ( mpi | MPI ) : only MPI (Message Passing Interface) |
---|
195 | ( omp | OMP ) : only OpenMP |
---|
196 | ( mpi_omp | MPI_OMP ) : hybrid MPI/OpenMP mode |
---|
197 | ( none | NONE | seq ) : sequential mode (default) |
---|
198 | |
---|
199 | [ -driver ] : compilation of ORCHIDEE offline standard driver |
---|
200 | [ -otherexec ] : compilation of other programs: teststomate, forcesoil, orchideedriver, testrouting. |
---|
201 | Warning! All these programs are not fully validated or maintained. |
---|
202 | |
---|
203 | Options related to cleaning |
---|
204 | | -clean ] : delete all files produceed during previous compilation |
---|
205 | | -full ] : activate full recompiling |
---|
206 | |
---|
207 | Options for XIOS, only choose one of the following |
---|
208 | [ -xios | -xios2 ] : linking with XIOS 2.0 (it is not longer possible to use XIOS1) |
---|
209 | [ -noxios ] : compilation without XIOS (default) |
---|
210 | |
---|
211 | Options for optimization, choose only one of the following |
---|
212 | [ -prod ] : compilation for production (all optimization) |
---|
213 | [ -dev ] : compilation for development (low optimization and -g) |
---|
214 | [ -debug ] : compilation for debugging (no optmization and all debug options) |
---|
215 | |
---|
216 | Option to optimize the compilation time |
---|
217 | [ -j x ] : activate parallel compiling on x task, default 1 task |
---|
218 | |
---|
219 | Option to add extra source to compile |
---|
220 | [ -ext_src path] : path to an additional directory with fortran routines to compile with the model |
---|
221 | |
---|
222 | Options for compiling the documentation : |
---|
223 | [ -doc ] : generate documentation with Doxygen (exit after doc computation) |
---|
224 | [ -doc_para ] : generate documentation with Doxygen with parallelization calls |
---|
225 | [ -rmdoc ] : remove documentation directory (before generate new documentation with Doxygen ?) |
---|
226 | [ -doc_tree ] : generate tree of ORCHIDEE directories for each file |
---|
227 | |
---|
228 | |
---|
229 | Example 1 : compile at curie(TGCC) for MPI parallel run mode |
---|
230 | ./makeorchidee_fcm -parallel mpi -arch X64_CURIE -driver |
---|
231 | |
---|
232 | Example 2 : compile at ada(IDRIS) for MPI-OpenMP parallel run mode |
---|
233 | ./makeorchidee_fcm -parallel mpi_omp -arch X64_ADA -driver |
---|
234 | |
---|
235 | Example 3 : compile at obelix(LSCE) |
---|
236 | ./makeorchidee_fcm -arch ifort_LSCE -driver |
---|
237 | |
---|
238 | Example 4 : compile using gfortran compiler for sequential run mode |
---|
239 | First make sure that the files arch/gfortran.fcm and arch/gfortran.path are suitable for |
---|
240 | your environement especially the path to netcdf library. |
---|
241 | ./makeorchidee_fcm -parallel seq -arch gfortran -driver |
---|
242 | |
---|
243 | Example 5 : clean files created during previous compilation |
---|
244 | ./makeorchidee_fcm -clean |
---|
245 | |
---|
246 | fin |
---|
247 | |
---|
248 | exit |
---|
249 | fi |
---|
250 | # |
---|
251 | # |
---|
252 | ##################################################################################################### |
---|
253 | # 4. Building the documentation: |
---|
254 | # ------------------------------ |
---|
255 | # We assume to start in the ORCHIDEE directory |
---|
256 | # |
---|
257 | #**** Directory structure: |
---|
258 | # |
---|
259 | # .. : parent of the start dir. |
---|
260 | # -- ORCHIDEE : ($MODELPATH), start directory |
---|
261 | # - src_sechiba |
---|
262 | # - src_stomate |
---|
263 | # + DOC |
---|
264 | # + webdoc |
---|
265 | # -- IOIPSL |
---|
266 | # - src |
---|
267 | # ++ modeles_doc : ($SRCPATH), source files for the documentation, emptied at start, temporary |
---|
268 | # |
---|
269 | #**** gawk scripts called : |
---|
270 | # |
---|
271 | # codeinc.awk : encaspulates code parts in Doxygen documentation |
---|
272 | # codedox.awk : transforms almost all comments in Doxygen comments for documentation |
---|
273 | # codealgo.awk : emphasizes main algorithm description of each routine in their Doxygen documentation |
---|
274 | # |
---|
275 | #**** |
---|
276 | if [[ "$comple_doc" == "TRUE" ]] ; then |
---|
277 | |
---|
278 | unalias cd |
---|
279 | |
---|
280 | export REV=`svn info | grep vision | sed -e 's&.*vision.*: \([0-9]*\)&\1&' | head -n 1` |
---|
281 | export TAG=`svn info | grep URL | sed -e 's&.*URL.*: svn://forge.ipsl.jussieu.fr/orchidee/\(.*\)&\1&' | head -n 1 | xargs dirname` |
---|
282 | cd .. |
---|
283 | |
---|
284 | \rm -rf modeles_doc |
---|
285 | export MODELPATH=${PWD} |
---|
286 | \mkdir modeles_doc |
---|
287 | export SRCPATH=${MODELPATH}/modeles_doc |
---|
288 | |
---|
289 | find IOIPSL/src \( -not -path '*.svn*' \ |
---|
290 | -a \( -name '*.f90' -o -name "*.F90" -o -name "*.h" \) \) \ |
---|
291 | -exec bash -c 'mkdir -p '${SRCPATH}'/$( dirname {} ); cp -p {} '${SRCPATH}'/$( dirname {} )' \; |
---|
292 | |
---|
293 | find ORCHIDEE \( -not -path '*.svn*' \ |
---|
294 | -a \( -name '*.f90' -o -name "*.F90" -o -name "*.h" \) \) \ |
---|
295 | -exec bash -c 'mkdir -p '${SRCPATH}'/$( dirname {} ); cp -p {} '${SRCPATH}'/$( dirname {} )' \; |
---|
296 | cd ${SRCPATH} |
---|
297 | # Use standard preprocessor to suppress all preproc directives |
---|
298 | \find . -name "*.f90" -exec cpp -P -C -traditional -x assembler-with-cpp ${P_P} '{}' '{}'_ \; |
---|
299 | \find . -name "*.f90" -print -exec mv -f '{}'_ '{}' \; |
---|
300 | |
---|
301 | # use codeinc script to encaspulate code parts in Doxygen documentation |
---|
302 | \find . -name "*.f90" -exec gawk -f ${MODELPATH}/ORCHIDEE/DOC/TOOLS/codeinc.awk '{}' \; > /dev/null |
---|
303 | \find . -name "*.f90" -print -exec mv -f '{}'_preproc_codeinc '{}' \; |
---|
304 | # use codedox script to transform almost all comments in Doxygen comments for documentation (use with care !) |
---|
305 | \find . -name "*.f90" -exec gawk -f ${MODELPATH}/ORCHIDEE/DOC/TOOLS/codedox.awk '{}' \; > /dev/null |
---|
306 | \find . -name "*.f90" -print -exec mv -f '{}'_preproc_codedox '{}' \; |
---|
307 | |
---|
308 | # use codealgo script to emphasize main algorithm description of each routine in their Doxygen documentation |
---|
309 | \find . -name "*.f90" -exec gawk -f ${MODELPATH}/ORCHIDEE/DOC/TOOLS/codealgo.awk '{}' \; > /dev/null |
---|
310 | \find . -name "*.f90" -print -exec mv -f '{}'_preproc_codealgo '{}' \; |
---|
311 | cd ../ORCHIDEE |
---|
312 | \rm -f ${MODELPATH}/ORCHIDEE/Doxyfile_ORCHIDEE |
---|
313 | sed -e 's&MYPATH&'${MODELPATH}'&g' -e 's&SRCPATH&'${SRCPATH}'&g' \ |
---|
314 | -e 's&MYTAG&'${TAG}'&' -e 's&MYREV&'${REV}'&' ${SECTIONS_PARA} \ |
---|
315 | ${MODELPATH}/ORCHIDEE/Doxyfile_ORCHIDEE.init > ${MODELPATH}/ORCHIDEE/Doxyfile_ORCHIDEE |
---|
316 | \rm -f ${MODELPATH}/ORCHIDEE/DOC/header.tex |
---|
317 | sed -e "s&MYTAG&${TAG}&" -e "s&MYREV&${REV}&" \ |
---|
318 | ${MODELPATH}/ORCHIDEE/DOC/header.tex.init > ${MODELPATH}/ORCHIDEE/DOC/header.tex |
---|
319 | ln -s /home/orchidee01/maignan/ORCHIDEE/DOC/IMAGES ${MODELPATH}/ORCHIDEE/DOC/IMAGES |
---|
320 | gmake doc |
---|
321 | gmake bib |
---|
322 | gmake toc |
---|
323 | \rm -rf ${MODELPATH}/ORCHIDEE/webdoc |
---|
324 | \mv ${MODELPATH}/ORCHIDEE/docs/html ${MODELPATH}/ORCHIDEE/webdoc |
---|
325 | gmake index |
---|
326 | gmake toc |
---|
327 | \rm -rf ${SRCPATH} |
---|
328 | cp ${MODELPATH}/ORCHIDEE/docs/latex/refman.pdf ${MODELPATH}/ORCHIDEE/documentation.pdf |
---|
329 | exit |
---|
330 | fi |
---|
331 | |
---|
332 | ##################################################################################################### |
---|
333 | # 5. Clean directory from files produced during previous compilation |
---|
334 | # -------------------------------------- |
---|
335 | if [[ "$clean" == "TRUE" ]] ; then |
---|
336 | rm -fr .config |
---|
337 | rm -fr lib |
---|
338 | rm -fr bin |
---|
339 | rm -fr tmp_src |
---|
340 | rm -f ../../lib/intersurf.mod |
---|
341 | rm -f ../../lib/chemistry.mod |
---|
342 | rm -f ../../lib/liborglob.a |
---|
343 | rm -f ../../lib/libparallel.a |
---|
344 | rm -f ../../lib/libsechiba.a |
---|
345 | rm -f ../../lib/libstomate.a |
---|
346 | rm -f ../../lib/libparameters.a |
---|
347 | rm -f ../../lib/liborchidee_ol.a |
---|
348 | rm -f ../../lib/liborchidee.a |
---|
349 | |
---|
350 | exit |
---|
351 | fi |
---|
352 | |
---|
353 | ######################################################################### |
---|
354 | # 6. Prepare compilation |
---|
355 | # |
---|
356 | # Add fcm in environement path |
---|
357 | export PATH=${fcm_path}:${PATH} |
---|
358 | |
---|
359 | # Define architecture files |
---|
360 | if [[ "$arch" != "NONE" ]] ; then |
---|
361 | if [[ -e arch/arch-${arch}.fcm ]] ; then |
---|
362 | rm -f arch.fcm |
---|
363 | ln -s arch/arch-${arch}.fcm arch.fcm |
---|
364 | else |
---|
365 | echo "architecture file : << arch/arch-${arch}.fcm >> is missing, exiting...." |
---|
366 | exit |
---|
367 | fi |
---|
368 | |
---|
369 | if [[ -e arch/arch-${arch}.path ]] ; then |
---|
370 | rm -f arch.path |
---|
371 | ln -s arch/arch-${arch}.path arch.path |
---|
372 | else |
---|
373 | echo "architecture file : << arch/arch-${arch}.path >> is missing, exiting...." |
---|
374 | exit |
---|
375 | fi |
---|
376 | else |
---|
377 | echo "Warning : architecture not specified, taking default file <<arch.fcm>> and <<arch.path>>" |
---|
378 | if [[ ! -e arch.fcm ]] ; then |
---|
379 | echo "architecture file : << arch.fcm >> is missing, exiting...." |
---|
380 | exit |
---|
381 | fi |
---|
382 | |
---|
383 | if [[ ! -e arch.fcm ]] ; then |
---|
384 | echo "architecture file : << arch.path >> is missing, exiting...." |
---|
385 | exit |
---|
386 | fi |
---|
387 | fi |
---|
388 | # |
---|
389 | # set compiler flags |
---|
390 | FFLAGS="%BASE_FFLAGS" |
---|
391 | LD_FFLAGS="%BASE_LD" |
---|
392 | CPP_KEY="%FPP_DEF" |
---|
393 | |
---|
394 | # set compiler flags for optimisation |
---|
395 | FFLAGS=${FFLAGS}" "$compile_flags |
---|
396 | LD_FFLAGS=${LD_FFLAGS}" "$compile_flags |
---|
397 | |
---|
398 | # set compiler flags for parallelism |
---|
399 | echo "parallel_mode = "${parallel_mode} |
---|
400 | |
---|
401 | if [[ "$parallel_mode" == "mpi" ]] || [[ "$parallel_mode" == "MPI" ]] ; then |
---|
402 | FFLAGS="${FFLAGS} %MPI_FFLAGS" |
---|
403 | LD_FFLAGS="%MPI_LD ${LD_FFLAGS}" |
---|
404 | CPP_KEY="CPP_PARA ${CPP_KEY}" |
---|
405 | elif [[ "$parallel_mode" == "omp" ]] || [[ "$parallel_mode" == "OMP" ]] ; then |
---|
406 | FFLAGS="${FFLAGS} %OMP_FFLAGS" |
---|
407 | LD_FFLAGS="%OMP_LD ${LD_FFLAGS}" |
---|
408 | CPP_KEY="CPP_OMP CPP_PARA ${CPP_KEY}" |
---|
409 | elif [[ "$parallel_mode" == "mpi_omp" ]] || [[ "$parallel_mode" == "MPI_OMP" ]] ; then |
---|
410 | FFLAGS="${FFLAGS} %MPI_FFLAGS %OMP_FFLAGS" |
---|
411 | LD_FFLAGS="%MPI_LD %OMP_LD ${LD_FFLAGS}" |
---|
412 | CPP_KEY="CPP_OMP CPP_PARA ${CPP_KEY}" |
---|
413 | elif [[ "$parallel_mode" == "none" ]] || [[ "$parallel_mode" == "NONE" ]] || [[ "$parallel_mode" == "seq" ]] ; then |
---|
414 | echo "Compiling for sequential mode" |
---|
415 | else |
---|
416 | echo "This option for parallel_mode is not implemeted. Choose between mpi, omp, mpi_omp and none." |
---|
417 | exit |
---|
418 | fi |
---|
419 | |
---|
420 | # |
---|
421 | # Get all the variables set in the path file for the current architecture |
---|
422 | # |
---|
423 | source ./arch.path |
---|
424 | # |
---|
425 | # Create some temporary variable to which we add as needed |
---|
426 | # |
---|
427 | INCDIR="-I$NETCDF_INCDIR -I$IOIPSL_INCDIR" |
---|
428 | LIBDIR="-L$NETCDF_LIBDIR -L$IOIPSL_LIBDIR" |
---|
429 | |
---|
430 | # Do we need to link with XIOS |
---|
431 | # |
---|
432 | if [[ "$xios" == "TRUE" ]] ; then |
---|
433 | CPP_KEY="XIOS ${CPP_KEY}" |
---|
434 | INCDIR="${INCDIR} -I$XIOS_INCDIR" |
---|
435 | LIBDIR="${LIBDIR} -L$XIOS_LIBDIR" |
---|
436 | fi |
---|
437 | |
---|
438 | # set target |
---|
439 | TARGET=liborchidee.a |
---|
440 | if [[ "$is_driver_opt" == "TRUE" ]] ; then |
---|
441 | TARGET="liborchidee_ol.a dim2_driver.exe" |
---|
442 | fi |
---|
443 | if [[ "$is_other_opt" == "TRUE" ]] ; then |
---|
444 | TARGET="${TARGET} orchideedriver.exe testrouting.exe" |
---|
445 | fi |
---|
446 | |
---|
447 | if [[ "$is_oasisdriver_opt" == "TRUE" ]] ; then |
---|
448 | CPP_KEY="OASIS ${CPP_KEY}" |
---|
449 | TARGET="${TARGET} driver2oasis.exe orchideeoasis.exe" |
---|
450 | INCDIR="${INCDIR} -I${OASIS_INCDIR}/psmile.MPI1 -I${OASIS_INCDIR}/scrip -I${OASIS_INCDIR}/mct" |
---|
451 | LIBDIR="${LIBDIR} -L${OASIS_LIBDIR} -lpsmile.MPI1 -lmct -lmpeu -lscrip" |
---|
452 | echo "OASIS : ${INCDIR}" |
---|
453 | fi |
---|
454 | |
---|
455 | # build config file |
---|
456 | config_fcm="config.fcm" |
---|
457 | rm -f $config_fcm |
---|
458 | touch $config_fcm |
---|
459 | |
---|
460 | echo "%ARCH $arch" >> $config_fcm |
---|
461 | echo "%FFLAGS $FFLAGS" >> $config_fcm |
---|
462 | echo "%CPP_KEY $CPP_KEY" >> $config_fcm |
---|
463 | echo "%EXEC $TARGET" >> $config_fcm |
---|
464 | echo "%LD_FFLAGS $LD_FFLAGS" >> $config_fcm |
---|
465 | echo "%INCDIR ${INCDIR}" >> $config_fcm |
---|
466 | echo "%LIBDIR ${LIBDIR}" >> $config_fcm |
---|
467 | echo "%EXT_SRC $ext_src" >> $config_fcm |
---|
468 | |
---|
469 | |
---|
470 | # Delete interface module from modipsl/lib directory |
---|
471 | rm -f ../../lib/intersurf.mod |
---|
472 | rm -f ../../lib/chemistry.mod |
---|
473 | |
---|
474 | # Check if compiling is locked |
---|
475 | if [ -f .config/fcm.bld.lock ] ; then |
---|
476 | echo "WARNING : build lock file exists" |
---|
477 | echo "This means that either someone else is compiling this directory right now " |
---|
478 | echo "or the previous compiling was interrupt abnormally." |
---|
479 | echo "" |
---|
480 | echo "Do you whant to remove this file and start compiling? [answer yes/no]" |
---|
481 | read answer |
---|
482 | if [ $answer = "yes" ] || [ $answer = "y" ] ; then |
---|
483 | rm -f .config/fcm.bld.lock |
---|
484 | else |
---|
485 | echo "Exit now!!!" |
---|
486 | exit 1 |
---|
487 | fi |
---|
488 | fi |
---|
489 | |
---|
490 | ######################################################################### |
---|
491 | # 7. Do the compiling |
---|
492 | fcm build -j $job $full |
---|
493 | err=$? |
---|
494 | if [ $err != 0 ] ; then |
---|
495 | # ERROR IN COMPILING |
---|
496 | echo ERROR IN COMPILING ORCHIDEE : $err |
---|
497 | exit 1 |
---|
498 | fi |
---|
499 | |
---|
500 | # Copy into modipsl/lib directory libraries and interface module needed by LMDZ |
---|
501 | cp lib/lib*a ../../lib/. |
---|
502 | cp lib/intersurf.mod ../../lib/. |
---|
503 | cp lib/chemistry.mod ../../lib/. |
---|
504 | |
---|
505 | # Move created executables to modipsl/bin directory |
---|
506 | if [ -f bin/dim2_driver.exe ] ; then mv bin/dim2_driver.exe ../../bin/orchidee_ol ; fi |
---|
507 | if [ -f bin/teststomate.exe ] ; then mv bin/teststomate.exe ../../bin/teststomate ; fi |
---|
508 | if [ -f bin/forcesoil.exe ] ; then mv bin/forcesoil.exe ../../bin/forcesoil ; fi |
---|
509 | if [ -f bin/orchideedriver.exe ] ; then mv bin/orchideedriver.exe ../../bin/orchideedriver ; fi |
---|
510 | if [ -f bin/testrouting.exe ] ; then mv bin/testrouting.exe ../../bin/testrouting ; fi |
---|
511 | if [ -f bin/friver2oasis.exe ] ; then mv bin/driver2oasis.exe ../../bin/driver2oasis ; fi |
---|
512 | if [ -f bin/orchideeoasis.exe ] ; then mv bin/orchideeoasis.exe ../../bin/orchideeoasis ; fi |
---|