1 | #!/bin/ksh |
---|
2 | ###################################################### |
---|
3 | # Author : Rachid benshila for ESOPA |
---|
4 | # Contact : opatlod@lodyc.jussieu.fr |
---|
5 | # |
---|
6 | # This script aims to create the NEMOTAM/WORK directory |
---|
7 | # with links to target directories for the sources |
---|
8 | # and to link in the WORK the BB_make and BB_make.ldef |
---|
9 | # associated to a chosen configuration |
---|
10 | # |
---|
11 | ###################################################### |
---|
12 | |
---|
13 | ################################### |
---|
14 | # # |
---|
15 | # Beginning of user modifications # |
---|
16 | # # |
---|
17 | ################################### |
---|
18 | #- Config name --- |
---|
19 | # To add a new configuration called NAME you have to change this script |
---|
20 | # 1. Add your configuration in LIST |
---|
21 | # 2. Add the directories needed for this config : set -A DIR_NAME DIR1 DIR2 ... |
---|
22 | # 3. Run fait_config NAME |
---|
23 | # If there is no directory config/NAME/scripts, and in this no BB_make.ldef, |
---|
24 | # the config/ORCA2_TAM directory is copied under NAME |
---|
25 | # |
---|
26 | LIST="ORCA2_TAM" |
---|
27 | set -A DIR_ORCA2_TAM OPATAM_SRC OPA_SRC C1D_SRC |
---|
28 | ################################### |
---|
29 | # # |
---|
30 | # End of user modifications # |
---|
31 | # # |
---|
32 | ################################### |
---|
33 | |
---|
34 | |
---|
35 | #- Some tests --- |
---|
36 | d_n=$(dirname $0); b_n=$(basename $0); |
---|
37 | |
---|
38 | if [ ${#} -gt 1 ]; then |
---|
39 | echo 'Only one configuration can be specified in:' 1>&2; |
---|
40 | echo $LIST 1>&2; |
---|
41 | exit 3; |
---|
42 | elif [ ${#} -eq 1 ]; then |
---|
43 | m_n="${1}" |
---|
44 | elif [ ${#} -eq 0 ]; then |
---|
45 | echo 'You must specify one configuration in :' 1>&2; |
---|
46 | echo $LIST 1>&2; |
---|
47 | echo 'You can also complete fait_config to add a new one' |
---|
48 | exit 3; |
---|
49 | fi |
---|
50 | |
---|
51 | #- Create the WORK -- |
---|
52 | d_m=`find ${d_n}/.. -name NEMOTAM` ; |
---|
53 | [ -d ${d_m}/WORK ] || mkdir ${d_m}/WORK; |
---|
54 | cd ${d_m}/WORK |
---|
55 | |
---|
56 | #- Clean links and librairies |
---|
57 | [ -f Makefile ] && gmake clean |
---|
58 | [ -n "`\ls`" ] && \rm -rf * |
---|
59 | |
---|
60 | #- Find the number of directories --- |
---|
61 | eval NDIR=\${#DIR_${m_n}[*]} |
---|
62 | |
---|
63 | #- Build a working array TAB containing the directories --- |
---|
64 | i=0 |
---|
65 | while [ i -lt $NDIR ] |
---|
66 | do |
---|
67 | eval TAB[i]=\${DIR_${m_n}[i]} |
---|
68 | let i=i+1 |
---|
69 | done |
---|
70 | |
---|
71 | #- Creating the good links, at first on OPATAM_SRC --- |
---|
72 | if [ ${#TAB[*]} -ne 0 ] ; then |
---|
73 | echo " Creating NEMOTAM/WORK = ${TAB[*]} for ${m_n}" |
---|
74 | |
---|
75 | i=0 |
---|
76 | while [ i -lt $NDIR ] |
---|
77 | do |
---|
78 | [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPATAM_SRC" ] && ln -sf ../OPATAM_SRC/*.[Ffh]90 . |
---|
79 | [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPATAM_SRC" ] && ln -sf ../OPATAM_SRC/*/*.[Ffh]90 . && break |
---|
80 | let i=$i+1 |
---|
81 | done |
---|
82 | i=0 |
---|
83 | while [ i -lt $NDIR ] |
---|
84 | do |
---|
85 | [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../../NEMO/OPA_SRC/*.[Ffh]90 . |
---|
86 | [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../../NEMO/OPA_SRC/*/*.[Ffh]90 . && break |
---|
87 | let i=$i+1 |
---|
88 | done |
---|
89 | i=0 |
---|
90 | while [ i -lt $NDIR ] |
---|
91 | do |
---|
92 | if [ "${TAB[i]}" = "C1D_SRC" ]; then |
---|
93 | ln -sf ../../NEMO/C1D_SRC/*.[Ffh]90 . |
---|
94 | elif [ "${TAB[i]}" = "LIM_SRC_2" ]; then |
---|
95 | ln -sf ../../NEMOLIM_SRC_2/*.[Ffh]90 . |
---|
96 | fi |
---|
97 | let i=$i+1 |
---|
98 | done |
---|
99 | |
---|
100 | [ ! -d ../../../config/${m_n} ] && \cp -R ../../../config/ORCA2_TAM ../../../config/${m_n} |
---|
101 | ln -sf ../../../*/${m_n}/scripts/BB_make AA_make ; |
---|
102 | ln -sf ../../../*/${m_n}/scripts/BB_make.ldef AA_make.ldef ; |
---|
103 | |
---|
104 | else |
---|
105 | |
---|
106 | echo "Configuration "${m_n}" not supported" 1>&2 |
---|
107 | echo 'Make your choice in :' 1>&2 |
---|
108 | echo $LIST 1>&2 |
---|
109 | echo 'You can also complete fait_config to add a new one' |
---|
110 | exit 1 |
---|
111 | |
---|
112 | fi |
---|
113 | |
---|
114 | #- Building the standard list of source files --- |
---|
115 | cat >.patron <<"EOF" |
---|
116 | CVS |
---|
117 | SRC_PARAM |
---|
118 | SRC_FILE_LIST |
---|
119 | tmplist |
---|
120 | AA_make |
---|
121 | KEY_CPP |
---|
122 | Makefile |
---|
123 | *?.o |
---|
124 | i.?* |
---|
125 | *?.L |
---|
126 | .patron |
---|
127 | bloc.com |
---|
128 | para.com |
---|
129 | defcst.f |
---|
130 | fontbc.f |
---|
131 | icdyna.f |
---|
132 | thersf.f |
---|
133 | OPAFILES |
---|
134 | EOF |
---|
135 | ls -1 | fgrep -v -f .patron >SRC_FILE_LIST ; cp SRC_FILE_LIST SRC_FILE_LIST.temp ; |
---|
136 | |
---|
137 | #- Writing KEY_CPP file --- |
---|
138 | sed -e /^P_P/\!d -e "s/P_P = //" AA_make.ldef > KEY_CPP; |
---|
139 | |
---|
140 | #- Save new configuration an d directories names --- |
---|
141 | print ${m_n} ${TAB[*]} >.config |
---|
142 | |
---|
143 | exit 0; |
---|