source:
trunk/NEMOGCM/TOOLS/COMPILE/Fmake_WORK.sh
@
3294
Last change on this file since 3294 was 3294, checked in by rblod, 12 years ago | |
---|---|
|
|
File size: 2.1 KB |
Rev | Line | |
---|---|---|
[1972] | 1 | #!/bin/bash |
2 | ###################################################### | |
3 | # Author : Rachid Benshila for NEMO | |
4 | # Contact : rblod@locean-ipsl.upmc.fr | |
5 | # | |
[2359] | 6 | # Some functions called from makenemo |
[1972] | 7 | # Fmake_WORK : create links in the WORK |
8 | ###################################################### | |
9 | #set -x | |
10 | set -o posix | |
11 | #set -u | |
12 | #set -e | |
13 | #+ | |
14 | # | |
15 | # ============= | |
16 | # Fmake_WORK.sh | |
17 | # ============= | |
18 | # | |
[2520] | 19 | # ----------------------- |
[1972] | 20 | # Make the WORK directory |
[2520] | 21 | # ----------------------- |
[1972] | 22 | # |
23 | # SYNOPSIS | |
24 | # ======== | |
25 | # | |
26 | # :: | |
27 | # | |
28 | # $ Fmake_WORK.sh | |
29 | # | |
30 | # | |
31 | # DESCRIPTION | |
32 | # =========== | |
33 | # | |
34 | # | |
35 | # Make the WORK directory: | |
36 | # | |
37 | # - Create lin in NEW_CONF/WORK | |
38 | # - Use specified sub-directories previously | |
39 | # - OPA has to be done first !!! | |
40 | # | |
[2520] | 41 | # |
[1972] | 42 | # EXAMPLES |
43 | # ======== | |
44 | # | |
45 | # :: | |
46 | # | |
[2520] | 47 | # $ ./Fmake_WORK.sh ORCA2_LIM OPA_SRC LIM_SRC_2 |
[1972] | 48 | # |
49 | # | |
50 | # TODO | |
51 | # ==== | |
52 | # | |
53 | # option debug | |
54 | # | |
55 | # | |
56 | # EVOLUTIONS | |
57 | # ========== | |
58 | # | |
59 | # $Id$ | |
60 | # | |
61 | # | |
62 | # | |
63 | # * creation | |
64 | # | |
65 | #- | |
[3294] | 66 | declare ZSRC=$1 ; shift |
67 | declare ZCONF=$1 ; shift | |
[1972] | 68 | ZTAB=( $@ ) |
69 | declare i=0 ; declare NDIR=${#ZTAB[@]} | |
70 | ||
71 | echo "Creating ${ZCONF}/WORK = ${ZTAB[*]} for ${ZCONF}" | |
72 | ||
73 | [ ! -d ${ZCONF}/MY_SRC ] && \mkdir ${ZCONF}/MY_SRC | |
74 | [ -d ${ZCONF}/WORK ] || \mkdir ${ZCONF}/WORK | |
75 | ||
[3294] | 76 | if [ "${ZSRC}" != "none" ] ; then |
77 | if [ -d ${ZSRC} ] ; then | |
78 | ln -sf ${ZSRC}/*.[Ffh]90 ${ZCONF}/MY_SRC/. | |
79 | echo "MY_SRC content is linked to ${ZSRC}" | |
80 | else | |
81 | echo "External directory for MY_SRC does not exist. Using default." | |
82 | fi | |
83 | else | |
84 | echo "MY_SRC directory is : ${ZCONF}/MY_SRC" | |
85 | fi | |
86 | ||
[1972] | 87 | \rm -f ../${1}/WORK/* |
88 | ||
89 | while [ $i -lt $NDIR ] | |
90 | do | |
91 | [ "${ZTAB[i]}" = "OPA_SRC" ] && ln -sf ${NEMO_DIR}/OPA_SRC/*.[Ffh]90 ${ZCONF}/WORK | |
92 | [ "${ZTAB[i]}" = "OPA_SRC" ] && ln -sf ${NEMO_DIR}/OPA_SRC/*/*.[Ffh]90 ${ZCONF}/WORK && break | |
93 | let i=$i+1 | |
94 | done | |
95 | ||
96 | i=0 | |
97 | while [ $i -lt $NDIR ] | |
98 | do | |
99 | if [ "${ZTAB[i]}" != "OPA_SRC" ]; then | |
100 | ln -sf ${NEMO_DIR}/${ZTAB[i]}/*.[Ffh]90 ${ZCONF}/WORK | |
101 | ln -sf ${NEMO_DIR}/${ZTAB[i]}/*/*.[Ffh]90 ${ZCONF}/WORK 2>/dev/null | |
102 | fi | |
103 | let i=$i+1 | |
104 | done | |
105 | ||
106 | for i in `(cd ${ZCONF}/MY_SRC ; ls *.[Ffh]90 2>/dev/null ) ` | |
107 | do | |
108 | [ -f ${ZCONF}/MY_SRC/$i ] && ln -sf $PWD/${ZCONF}/MY_SRC/${i} ${ZCONF}/WORK/. | |
109 | done | |
110 | ||
111 | unset -v ZCONF | |
112 | unset -v ZTAB | |
113 | unset -v i | |
114 | unset -v NDIR | |
115 |
Note: See TracBrowser
for help on using the repository browser.