Changeset 2354
- Timestamp:
- 2010-11-04T15:40:10+01:00 (14 years ago)
- Location:
- branches/nemo_v3_3_beta/NEMOGCM
- Files:
-
- 8 added
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/nemo_v3_3_beta/NEMOGCM/CONFIG/makenemo
r2324 r2354 79 79 #- Local variables --- 80 80 b_n=$(basename ${0}) 81 export MAIN_DIR=${PWD%/CONFIG*} 82 export CONFIG_DIR=${MAIN_DIR}/CONFIG 83 export TOOLS_DIR=${MAIN_DIR}/TOOLS 84 export COMPIL_DIR=${MAIN_DIR}/TOOLS/COMPILE 85 export NEMO_DIR=${MAIN_DIR}/NEMO 86 export AGRIFUSE=10 87 88 declare -a TAB 81 OPTIND=1 82 MAIN_DIR=$(cd $(dirname "$0"); pwd) 83 MAIN_DIR=${MAIN_DIR%/SETTE*} 84 MAIN_DIR=${MAIN_DIR%/TOOLS*} 85 MAIN_DIR=${MAIN_DIR%/CONFIG*} 86 export MAIN_DIR 87 # 88 export CONFIG_DIR=${MAIN_DIR}/CONFIG 89 export TOOLS_DIR=${MAIN_DIR}/TOOLS 90 export COMPIL_DIR=${MAIN_DIR}/TOOLS/COMPILE 91 export NEMO_DIR=${MAIN_DIR}/NEMO 92 export AGRIFUSE=10 93 94 declare -a TAB 89 95 #- 90 96 #- FCM and functions location --- 91 export PATH=${MAIN_DIR}/EXTERNAL/fcm/bin:$PATH97 export PATH=${MAIN_DIR}/EXTERNAL/fcm/bin:$PATH 92 98 93 99 #- 94 100 #- Choice of the options --- 95 x_d="";96 x_n="";97 x_r="";98 x_m="";99 x_t="";100 x_c="";101 x_j=1;102 while getopts :hd:n:r:m:j:t: V103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 101 x_d=""; 102 x_n=""; 103 x_r=""; 104 x_m=""; 105 x_t=""; 106 x_c=""; 107 x_j=1; 108 while getopts :hd:n:r:m:j:t: V 109 do 110 case $V in 111 (h) echo "Usage : "${b_n} \ 112 " [-h] [-n name] [-m arch] [-d "dir1 dir2"] [-r conf] [-j No]"; 113 echo " -h : help"; 114 echo " -n name : config name, [-n help] to list existing configurations"; 115 echo " -m arch : choose compiler, [-m help] to list existing compilers"; 116 echo " -d dir : choose NEMO sub-directories"; 117 echo " -r conf : choose reference configuration"; 118 echo " -j No : number of processes used to compile (0=nocompilation)"; 119 echo " -t dir : temporary directory for compilation" 120 echo ""; 121 echo "Example to install a new configuration MY_CONFIG"; 122 echo "with OPA_SRC and LIM_SRC_2 "; 123 echo "makenemo -n MY_CONFIG -d \"OPA_SRC LIM_SRC_2\""; 124 echo ""; 125 echo "Available configurations :"; cat ${COMPIL_DIR}/cfg.txt; 126 echo ""; 127 echo "Example to remove bad configuration "; 128 echo "./makenemo -n MY_CONFIG clean_config"; 129 echo ""; 130 echo "Example to clean "; 131 echo "./makenemo clean"; 132 echo ""; 133 echo "Example to add and remove keys"; 134 echo "./makenemo add_key \"key_iomput key_mpp_mpi\" del_key \"key_agrif\" "; 135 echo ""; 136 echo "Example to add and remove keys for a new configuration, and do not compile"; 137 echo "./makenemo -n MY_CONFIG -j0 add_key \"key_iomput key_mpp_mpi\" del_key \"key_agrif\" "; 138 echo ""; 139 . ${COMPIL_DIR}/Flist_archfile.sh ; 140 echo ""; 141 echo "Default : previous configuration and compiler"; 142 exit 0;; 143 (d) x_d=${OPTARG};; 144 (n) x_n=${OPTARG};; 145 (r) x_r=${OPTARG};; 146 (m) x_m=${OPTARG};; 147 (j) x_j=${OPTARG};; 148 (t) x_t=${OPTARG};; 149 (:) echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2; 150 exit 2;; 151 (\?) echo ${b_n}" : -"${OPTARG}" option : not supported" 1>&2; 152 exit 2;; 153 esac 154 done 149 155 shift $(($OPTIND-1)); 150 156 151 157 while [ ${#1} -gt 0 ] # Get clean, clean_config options 152 158 do 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 159 case "$1" in 160 clean) 161 x_c="--$1" 162 ;; 163 clean_config) 164 . ${COMPIL_DIR}/Fclean_config.sh 165 exit 166 ;; 167 add_key) 168 list_add_key=$2 169 export ${list_add_key} 170 shift 171 ;; 172 del_key) 173 list_del_key=$2 174 export ${list_del_key} 175 shift 176 ;; 177 *) 178 echo " \"$1\" BAD OPTION" 179 exit 180 ;; 181 182 esac 177 183 shift 178 184 done … … 195 201 #- Check if the tool or the compiler exist or list it 196 202 if [ "${NEW_CONF}" == help ] ; then 197 198 203 echo "Available configurations :" 204 cat ${COMPIL_DIR}/cfg.txt 199 205 exit 200 206 fi … … 209 215 . ${COMPIL_DIR}/Fcheck_config.sh cfg.txt ${NEW_CONF} || exit 210 216 217 211 218 if [ ${#NEW_CONF} -eq 0 ] ; then 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 219 if [ ${#NEM_SUBDIR} -eq 0 -a ${#REF_CONF} -eq 0 ]; then 220 echo "You are installing a new configuration" 221 ind=0 222 . ${COMPIL_DIR}/Fread_dir.sh OPA_SRC YES 223 . ${COMPIL_DIR}/Fread_dir.sh LIM_SRC_2 YES 224 . ${COMPIL_DIR}/Fread_dir.sh LIM_SRC_3 NO 225 . ${COMPIL_DIR}/Fread_dir.sh TOP_SRC NO 226 . ${COMPIL_DIR}/Fread_dir.sh C1D_SRC YES 227 . ${COMPIL_DIR}/Fread_dir.sh NST_SRC YES 228 . ${COMPIL_DIR}/Fread_dir.sh OFF_SRC NO 229 REF_CONF=ORCA2_LIM 230 elif [ ${#NEM_SUBDIR} -gt 0 ] && [ ${#REF_CONF} -eq 0 ]; then 231 echo "You are installing a new configuration" 232 TAB=( ${NEM_SUBDIR} ) 233 REF_CONF=ORCA2_LIM 227 234 elif [ ${#NEM_SUBDIR} -eq 0 ] && [ ${#REF_CONF} -gt 0 ]; then 228 229 235 echo "You are installing a new configuration based on ${REF_CONF}" 236 . ${COMPIL_DIR}/Fcopy_dir.sh ${REF_CONF} 230 237 fi 231 238 NEW_CONF=${x_n} 232 233 else239 . ${COMPIL_DIR}/Fmake_config.sh ${NEW_CONF} ${REF_CONF} 240 else 234 241 sed -e "/${NEW_CONF} /d" ${COMPIL_DIR}/cfg.txt > ${COMPIL_DIR}/cfg.tmp 235 242 \mv ${COMPIL_DIR}/cfg.tmp ${COMPIL_DIR}/cfg.txt 236 fi243 fi 237 244 238 245 #- 239 246 #- Save new configuration and directories names --- 240 echo ${NEW_CONF} ${TAB[*]} >> ${COMPIL_DIR}/cfg.txt247 echo ${NEW_CONF} ${TAB[*]} >> ${COMPIL_DIR}/cfg.txt 241 248 242 249 #- … … 244 251 #- Clean links and librairies --- 245 252 #- Creating the good links, at first on OPA_SRC --- 246 . ${COMPIL_DIR}/Fmake_WORK.sh ${NEW_CONF} ${TAB[*]} || exit247 248 . ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF} ${NEMO_TDIR} || exit253 . ${COMPIL_DIR}/Fmake_WORK.sh ${NEW_CONF} ${TAB[*]} || exit 254 255 . ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF} ${NEMO_TDIR} || exit 249 256 250 257 #- At this stage new configuration has been added, 251 258 #- We add or remove keys 252 if [ ${#list_add_key} -ne 0 ] ; then259 if [ ${#list_add_key} -ne 0 ] ; then 253 260 . ${COMPIL_DIR}/Fadd_keys.sh ${NEW_CONF} add_key ${list_add_key} 254 fi255 256 if [ ${#list_del_key} -ne 0 ] ; then261 fi 262 263 if [ ${#list_del_key} -ne 0 ] ; then 257 264 . ${COMPIL_DIR}/Fdel_keys.sh ${NEW_CONF} del_key ${list_del_key} 258 fi265 fi 259 266 260 267 #- At this stage the configuration has beeen chosen 261 268 #- We look after agrif 262 grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1263 . ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} || exit269 grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1 270 . ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} || exit 264 271 265 272 #- and test whether we need to build the ioserver 266 export USEBLD=bldxio.cfg267 grep key_iomput ${COMPIL_DIR}/cpp.fcm && export USEBLD=bld.cfg273 export USEBLD=bldxio.cfg 274 grep key_iomput ${COMPIL_DIR}/cpp.fcm && export USEBLD=bld.cfg 268 275 269 276 #- … … 274 281 #- Compile --- 275 282 276 if [ "${NBR_PRC}" -gt 0 ]; then277 278 279 280 281 282 283 fi284 fcm build ${x_c} --ignore-lock -v 1 -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || cd -285 [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ] && ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${CONFIG_DIR}/${NEW_CONF}/EXP00/opa286 [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/server.exe ] && ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/server.exe ${CONFIG_DIR}/${NEW_CONF}/EXP00/server.exe287 288 289 290 291 292 293 294 295 296 283 if [ "${NBR_PRC}" -gt 0 ]; then 284 cd ${NEMO_TDIR}/${NEW_CONF} || cd - 285 286 #if AGRIF we do a first preprocessing 287 if [ ${#x_c} -eq 0 ]; then 288 [ "$AGRIFUSE" == 1 ] && fcm build --ignore-lock -s 2 ${COMPIL_DIR}/$USEBLD 289 [ "$AGRIFUSE" == 1 ] && rm -rf ${NEMO_TDIR}/${NEW_CONF}/BLD/* 290 fi 291 fcm build ${x_c} --ignore-lock -v 1 -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || cd - 292 [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ] && ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${CONFIG_DIR}/${NEW_CONF}/EXP00/opa 293 [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/server.exe ] && ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/server.exe ${CONFIG_DIR}/${NEW_CONF}/EXP00/server.exe 294 295 #add remove for clean option 296 if [ ${#x_c} -ne 0 ]; then 297 rm -rf ${NEMO_TDIR}/${NEW_CONF}/WORK 298 rm -rf ${NEMO_TDIR}/${NEW_CONF}/BLD 299 rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/opa 300 rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/server.exe 301 echo "cleaning ${NEW_CONF} WORK, BLD" 302 fi 303 297 304 fi 298 305 … … 306 313 307 314 308 exit 0;
Note: See TracChangeset
for help on using the changeset viewer.