Changeset 2359 for branches/nemo_v3_3_beta/NEMOGCM/CONFIG/makenemo
- Timestamp:
- 2010-11-05T10:28:31+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/nemo_v3_3_beta/NEMOGCM/CONFIG/makenemo
r2354 r2359 79 79 #- Local variables --- 80 80 b_n=$(basename ${0}) 81 82 83 84 85 86 87 # 88 89 90 91 92 93 94 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 95 95 #- 96 96 #- FCM and functions location --- 97 97 export PATH=${MAIN_DIR}/EXTERNAL/fcm/bin:$PATH 98 98 99 99 #- 100 100 #- Choice of the options --- 101 102 103 104 105 106 107 108 109 110 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 111 (h) echo "Usage : "${b_n} \ 112 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 esac112 " [-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 154 done 155 155 shift $(($OPTIND-1)); … … 157 157 while [ ${#1} -gt 0 ] # Get clean, clean_config options 158 158 do 159 case "$1" in160 clean)161 x_c="--$1"162 ;;163 clean_config)164 . ${COMPIL_DIR}/Fclean_config.sh165 exit166 ;;167 add_key)168 list_add_key=$2169 export ${list_add_key}170 shift171 ;;172 del_key)173 list_del_key=$2174 export ${list_del_key}175 shift176 ;;177 *)178 echo " \"$1\" BAD OPTION"179 exit180 ;;181 182 esac183 shift159 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 183 shift 184 184 done 185 185 … … 201 201 #- Check if the tool or the compiler exist or list it 202 202 if [ "${NEW_CONF}" == help ] ; then 203 echo "Available configurations :"204 cat ${COMPIL_DIR}/cfg.txt205 exit203 echo "Available configurations :" 204 cat ${COMPIL_DIR}/cfg.txt 205 exit 206 206 fi 207 207 [ "${CMP_NAM}" == help ] && . ${COMPIL_DIR}/Flist_archfile.sh && exit … … 217 217 218 218 if [ ${#NEW_CONF} -eq 0 ] ; then 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 219 if [ ${#NEM_SUBDIR} -eq 0 -a ${#REF_CONF} -eq 0 ]; then 231 220 echo "You are installing a new configuration" 232 TAB=( ${NEM_SUBDIR} ) 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 233 229 REF_CONF=ORCA2_LIM 234 elif [ ${#NEM_SUBDIR} -eq 0 ] && [ ${#REF_CONF} -gt 0 ]; then 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 234 elif [ ${#NEM_SUBDIR} -eq 0 ] && [ ${#REF_CONF} -gt 0 ]; then 235 235 echo "You are installing a new configuration based on ${REF_CONF}" 236 236 . ${COMPIL_DIR}/Fcopy_dir.sh ${REF_CONF} 237 238 239 240 241 242 243 237 fi 238 NEW_CONF=${x_n} 239 . ${COMPIL_DIR}/Fmake_config.sh ${NEW_CONF} ${REF_CONF} 240 else 241 sed -e "/${NEW_CONF} /d" ${COMPIL_DIR}/cfg.txt > ${COMPIL_DIR}/cfg.tmp 242 \mv ${COMPIL_DIR}/cfg.tmp ${COMPIL_DIR}/cfg.txt 243 fi 244 244 245 245 #- 246 246 #- Save new configuration and directories names --- 247 247 echo ${NEW_CONF} ${TAB[*]} >> ${COMPIL_DIR}/cfg.txt 248 248 249 249 #- … … 251 251 #- Clean links and librairies --- 252 252 #- Creating the good links, at first on OPA_SRC --- 253 254 255 253 . ${COMPIL_DIR}/Fmake_WORK.sh ${NEW_CONF} ${TAB[*]} || exit 254 255 . ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF} ${NEMO_TDIR} || exit 256 256 257 257 #- At this stage new configuration has been added, 258 258 #- We add or remove keys 259 260 261 262 263 264 265 259 if [ ${#list_add_key} -ne 0 ] ; then 260 . ${COMPIL_DIR}/Fadd_keys.sh ${NEW_CONF} add_key ${list_add_key} 261 fi 262 263 if [ ${#list_del_key} -ne 0 ] ; then 264 . ${COMPIL_DIR}/Fdel_keys.sh ${NEW_CONF} del_key ${list_del_key} 265 fi 266 266 267 267 #- At this stage the configuration has beeen chosen 268 268 #- We look after agrif 269 270 269 grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1 270 . ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} || exit 271 271 272 272 #- and test whether we need to build the ioserver 273 274 273 export USEBLD=bldxio.cfg 274 grep key_iomput ${COMPIL_DIR}/cpp.fcm && export USEBLD=bld.cfg 275 275 276 276 #- … … 281 281 #- Compile --- 282 282 283 284 285 283 if [ "${NBR_PRC}" -gt 0 ]; then 284 cd ${NEMO_TDIR}/${NEW_CONF} || cd - 285 286 286 #if AGRIF we do a first preprocessing 287 287 if [ ${#x_c} -eq 0 ]; then 288 288 [ "$AGRIFUSE" == 1 ] && fcm build --ignore-lock -s 2 ${COMPIL_DIR}/$USEBLD 289 289 [ "$AGRIFUSE" == 1 ] && rm -rf ${NEMO_TDIR}/${NEW_CONF}/BLD/* 290 291 292 293 294 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 295 #add remove for clean option 296 if [ ${#x_c} -ne 0 ]; then297 rm -rf ${NEMO_TDIR}/${NEW_CONF}/WORK298 rm -rf ${NEMO_TDIR}/${NEW_CONF}/BLD299 rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/opa300 rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/server.exe301 echo "cleaning ${NEW_CONF} WORK, BLD"302 fi303 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 304 304 fi 305 305
Note: See TracChangeset
for help on using the changeset viewer.