- Timestamp:
- 2018-05-28T08:47:14+02:00 (6 years ago)
- Location:
- utils/build
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
utils/build/makenemo
r9623 r9651 41 41 # - CMP_NAM : compiler name 42 42 # - NBR_PRC : number of processes used to compile 43 # - USP_CONF : unsupported (external) configuration to build the new one from43 # - RMT_CONF : unsupported (external) configuration to build the new one from 44 44 # - NEM_SUBDIR : NEMO subdirectory used (specified) 45 45 # … … 63 63 # :: 64 64 # 65 # $ ./makenemo -m ifort_osx - j3 -n ORCA2_ LIM3_PISCES65 # $ ./makenemo -m ifort_osx - j3 -n ORCA2_SI3_PISCES 66 66 # 67 67 # … … 84 84 85 85 #- 86 #- Initialization of the options --- 87 x_d=""; 88 x_h=""; 89 x_n=""; 90 x_r=""; 91 x_u=""; 92 x_a=""; 93 x_m=""; 94 x_t=""; 95 x_c=""; 96 x_j=1; 97 x_e="none"; 98 x_s=src; 99 x_v=1; 100 101 #- Local variables --- 86 ##- Initialization of the options --- 87 x_d=''; x_h=''; x_n=''; x_r=''; 88 x_u=''; x_a=''; x_m=''; x_t=''; 89 x_c=''; 90 x_j='1'; x_e='none'; x_s='src'; x_v='1' 91 92 ##- Local variables --- 102 93 b_n=$(basename ${0}) 103 OPTIND= 194 OPTIND='1' 104 95 MAIN_DIR=$(cd $(dirname "$0"); pwd) 105 MAIN_DIR=${MAIN_DIR%/ SETTE*}96 MAIN_DIR=${MAIN_DIR%/sette*} 106 97 MAIN_DIR=${MAIN_DIR%/tools*} 107 98 MAIN_DIR=${MAIN_DIR%/cfgs*} … … 112 103 export COMPIL_DIR=${MAIN_DIR}/mk 113 104 export NEMO_DIR=${MAIN_DIR}/${x_s} 114 export AGRIFUSE=10 115 declare -a TAB 116 declare -a REMOTE_CTL 117 declare -a LOCAL_REF 118 list_key=0 119 chk_key=1 105 export AGRIFUSE='10' 106 list_key='0'; chk_key='1' 107 list_add_key=''; list_del_key=''; 108 conf_file='ref_cfgs.txt' 120 109 #- 121 110 #- FCM and functions location --- … … 124 113 #- 125 114 #- Choice of the options --- 126 while getopts :hd:n:r:u:a:m:j:e:s:v:t:k: V 127 do 128 case $V in 129 (h) x_h=${OPTARG}; 130 echo "Usage : "${b_n} \ 131 " [-h] [-n name] [-m arch] [-d "dir1 dir2"] [-r conf] [-u conf] [-s Path] [-e Path] [-j No] [-v No] [-k 0/1]"; 132 echo " -h : help"; 133 echo " -h institute : specific help for consortium members"; 134 echo " -n name : config name, [-n help] to list existing configurations"; 135 echo " -m arch : choose compiler, [-m help] to list existing compilers"; 136 echo " -d dir : choose NEMO sub-directories"; 137 echo " -r conf : choose reference configuration"; 138 echo " -u conf : choose an unsupported (external) configuration"; 139 echo " -s Path : choose alternative location for NEMO main directory"; 140 echo " -e Path : choose alternative location for MY_SRC directory"; 141 echo " -j No : number of processes used to compile (0=nocompilation)"; 142 echo " -v No : set verbosity level for compilation [0-3]"; 143 echo " -k 0/1 : used cpp keys check (default = 1 -> check activated)"; 144 echo " -t dir : temporary directory for compilation" 145 echo " -a dir : alternative sub-directory for configurations (below CONFIG)" 146 echo ""; 147 echo "Example to install a new configuration MY_CONFIG"; 148 echo "with OCE and ICE "; 149 echo "makenemo -n MY_CONFIG -d \"OCE ICE\""; 150 echo ""; 151 echo "Available configurations :"; cat ${CONFIG_DIR}/cfg.txt; 152 echo ""; 153 echo "Available unsupported (external) configurations :"; 154 if [ -f ${CONFIG_DIR}/uspcfg.txt ] ; then cat ${CONFIG_DIR}/uspcfg.txt; fi; 155 echo ""; 156 echo "Example to install an unsupoorted configuration MY_USP"; 157 echo "makenemo -n MY_USP -u MY_USP" ; 158 echo ""; 159 echo "Example to remove bad configuration "; 160 echo "./makenemo -n MY_CONFIG clean_config"; 161 echo ""; 162 echo "Example to clean "; 163 echo "./makenemo clean"; 164 echo ""; 165 echo "Example to list the available keys of a CONFIG "; 166 echo "./makenemo list_key"; 167 echo ""; 168 echo "Example to add and remove keys"; 169 echo "./makenemo add_key \"key_iomput key_mpp_mpi\" del_key \"key_agrif\" "; 170 echo ""; 171 echo "Example to add and remove keys for a new configuration, and do not compile"; 172 echo "./makenemo -n MY_CONFIG -j0 add_key \"key_iomput key_mpp_mpi\" del_key \"key_agrif\" "; 173 echo ""; 174 . ${COMPIL_DIR}/Flist_archfile.sh ${x_h} ; 175 echo ""; 176 echo "Default : previous configuration and compiler"; 177 exit 0;; 178 (d) x_d=${OPTARG};; 179 (n) x_n=${OPTARG};; 180 (r) x_r=${OPTARG};; 181 (u) x_u=${OPTARG};; 182 (a) x_a=${OPTARG};; 183 (m) x_m=${OPTARG};; 184 (j) x_j=${OPTARG};; 185 (t) x_t=${OPTARG};; 186 (e) x_e=${OPTARG};; 187 (s) x_s=${OPTARG};; 188 (v) x_v=${OPTARG};; 189 (k) chk_key=${OPTARG};; 190 (:) echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2; 191 exit 2;; 192 (\?) echo ${b_n}" : -"${OPTARG}" option : not supported" 1>&2; 193 exit 2;; 194 esac 115 while getopts :hd:n:r:u:a:m:j:e:s:v:t:k: option; do 116 117 case $option in 118 ('h') cat <<EOF 119 Usage: 120 ------ 121 ./makenemo -[adru] ... -m ... [-h] [-[dejntv] ...] [{list_key,clean,clean_config}] [{add_key,del_key} ...] 122 123 The previous build is reused by default if no given options 124 125 Mandatory: 'all' to list available arguments by option 126 -a Demonstration case (./tests) 127 -m Computing architecture (./arch) 128 -r Reference configuration (./cfgs) 129 -u Scripted remote configuration (./tests/rmt_cfgs.txt) 130 131 Optional: 132 -d Set of new sub-components (space separated list from ./src directory) 133 -e Path for alternative patch location (default: 'MY_SRC' in configuration folder) 134 -j Number of processes to compile (0: no build) 135 -n Name for new configuration 136 -s Path for alternative source location (default: 'src' root directory) 137 -t Path for alternative build location (default: 'BLD' in configuration folder) 138 -v Level of verbosity ([0-3]) 139 140 Examples: 141 ¤ Configuration build 142 Creation : ./makenemo -[adru] ... -m ... [...] 143 Duplication : ./makenemo -r ... -n ... [...] 144 ¤ Configuration management 145 List CPP keys : ./makenemo [...] list_key 146 Add-Remove keys: ./makenemo [...] add_key '...' del_key '...' 147 Fresh start : ./makenemo [...] clean 148 Erasure : ./makenemo [...] clean_config 149 150 EOF 151 exit 0 ;; 152 ('d') x_d=${OPTARG};; ('n') x_n=${OPTARG};; ('r') x_r=${OPTARG};; ('u') x_u=${OPTARG};; 153 ('a') x_a=${OPTARG};; ('m') x_m=${OPTARG};; ('j') x_j=${OPTARG};; ('t') x_t=${OPTARG};; 154 ('e') x_e=${OPTARG};; ('s') x_s=${OPTARG};; ('v') x_v=${OPTARG} ;; 155 ('k') chk_key=${OPTARG} ;; 156 (':') echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2; exit 2 ;; 157 ('?') echo ${b_n}" : -"${OPTARG}" option : not supported" 1>&2; exit 2 ;; 158 esac 159 195 160 done 161 196 162 shift $(($OPTIND-1)); 197 163 198 while [ ${#1} -gt 0 ] # Get clean, clean_config options 199 do 200 case "$1" in 201 clean) 202 x_c="--$1" 203 ;; 204 clean_config) 205 . ${COMPIL_DIR}/Fclean_config.sh 206 exit 207 ;; 208 add_key) 209 # Checking if argument has anything other than whitespace 210 [[ ! "$2" =~ ^\ +$ ]] && { list_add_key=$2; export ${list_add_key}; } 211 shift 212 ;; 213 del_key) 214 # Checking if argument has anything other than whitespace 215 [[ ! "$2" =~ ^\ +$ ]] && { list_del_key=$2; export ${list_del_key}; } 216 shift 217 ;; 218 list_key) 219 list_key=1 220 ;; 221 *) 222 echo " \"$1\" BAD OPTION" 223 exit 2 224 ;; 225 226 esac 227 shift 164 ## Get clean, clean_config options 165 while [ ${#1} -gt 0 ]; do 166 167 case "$1" in 168 'clean' ) x_c="--$1" ;; 169 'clean_config') . ${COMPIL_DIR}/Fclean_config.sh; exit ;; 170 ## Checking if argument has anything other than whitespace 171 'add_key' ) [[ ! "$2" =~ ^\ +$ ]] && list_add_key=$2; shift;; 172 'del_key' ) [[ ! "$2" =~ ^\ +$ ]] && list_del_key=$2; shift;; 173 'list_key' ) list_key='1' ;; 174 '*' ) echo " \"$1\" BAD OPTION"; exit 2 ;; 175 esac 176 177 shift 228 178 done 229 179 230 180 231 #-232 #- Go to NEMOGCM/cfgs directory ---233 cd ${CONFIG_DIR}234 235 #-236 #- Initialisation from input ---237 export ALT_DIR=${x_a}238 if [ ! -z $ALT_DIR ]; then239 if [ -d ${CONFIG_DIR}/${ALT_DIR} ]; then240 export CONFIG_DIR=${CONFIG_DIR}/${ALT_DIR}241 #-242 #- Go to named subdirectory of the NEMOGCM/cfgs directory ---243 cd ${CONFIG_DIR}244 fi245 fi246 181 export NEW_CONF=${x_n} 247 182 NBR_PRC=${x_j} … … 249 184 NEM_SUBDIR=${x_d} 250 185 REF_CONF=${x_r} 251 USP_CONF=${x_u}252 NEMO_TDIR=${x_t}253 export NEMO_TDIR=${NEMO_TDIR:-$CONFIG_DIR}186 DEMO_CONF=${x_a} 187 RMT_CONF=${x_u} 188 TML_CONF=${REF_CONF} 254 189 export NEMO_DIR=${MAIN_DIR}/${x_s} 255 190 256 #- Check if the tool or the compiler exist or list it 257 if [ "${NEW_CONF}" == help ] ; then 258 echo "Available configurations :" 259 cat ${CONFIG_DIR}/cfg.txt 260 echo 261 echo "Available unsupported (external) configurations :" 262 if [ -f ${CONFIG_DIR}/uspcfg.txt ] ; then cat ${CONFIG_DIR}/uspcfg.txt; fi; 263 exit 264 fi 265 [ "${CMP_NAM}" == help ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit 266 267 #- 268 #- Choose a default configuration if needed --- 269 #- ORCA2_LIM3_PISCES or last one used --- 270 . ${COMPIL_DIR}/Fcheck_config.sh cfg.txt ${NEW_CONF} || exit 271 272 if [ ${#NEW_CONF} -eq 0 ] ; then 273 if [ ${#NEM_SUBDIR} -eq 0 ] && [ ${#REF_CONF} -eq 0 ] && [ ${#USP_CONF} -eq 0 ] ; then 274 echo "You are installing a new default (ORCA2_LIM3_PISCES) configuration" 275 ind=0 276 . ${COMPIL_DIR}/Fread_dir.sh OCE YES 277 . ${COMPIL_DIR}/Fread_dir.sh ICE NO 278 . ${COMPIL_DIR}/Fread_dir.sh TOP NO 279 . ${COMPIL_DIR}/Fread_dir.sh NST YES 280 . ${COMPIL_DIR}/Fread_dir.sh OFF NO 281 . ${COMPIL_DIR}/Fread_dir.sh SAO NO 282 . ${COMPIL_DIR}/Fread_dir.sh SAS NO 283 REF_CONF=ORCA2_LIM3_PISCES 284 elif [ ${#NEM_SUBDIR} -gt 0 ] && [ ${#REF_CONF} -eq 0 ] && [ ${#USP_CONF} -eq 0 ] ; then 285 echo "You are installing a new configuration based on ORCA2_LIM3_PISCES" 286 TAB=( ${NEM_SUBDIR} ) 287 REF_CONF=ORCA2_LIM3_PISCES 288 elif [ ${#NEM_SUBDIR} -eq 0 ] && [ ${#REF_CONF} -gt 0 ]; then 289 echo "You are installing a new configuration based on ${REF_CONF}" 290 . ${COMPIL_DIR}/Fcopy_dir.sh ${REF_CONF} 291 elif [ ${#NEM_SUBDIR} -gt 0 ] && [ ${#REF_CONF} -gt 0 ]; then 292 echo "You are installing an hydrid configuration based on ${REF_CONF} with components ${NEM_SUBDIR}" 293 . ${COMPIL_DIR}/Fcopy_dir.sh ${REF_CONF} 294 TAB=( ${NEM_SUBDIR} ) 295 elif [ ${#NEM_SUBDIR} -eq 0 ] && [ ${#USP_CONF} -gt 0 ]; then 296 echo "You are installing a new configuration based on the unsupported (external) ${USP_CONF}" 297 . ${COMPIL_DIR}/Fcopy_extdir.sh ${USP_CONF} 298 #echo "TTT " ${TAB} 299 #echo "RRR " ${REMOTE_CTL} 300 #echo "LLL " ${LOCAL_REF} 301 fi 302 NEW_CONF=${x_n} 303 304 if [ ${#USP_CONF} -gt 0 ]; then 305 . ${COMPIL_DIR}/Fmake_extconfig.sh ${NEW_CONF} ${LOCAL_REF} 306 . ${COMPIL_DIR}/Ffetch_extdir.sh ${NEW_CONF} ${REMOTE_CTL} 307 else 308 . ${COMPIL_DIR}/Fmake_config.sh ${NEW_CONF} ${REF_CONF} 309 fi 191 [ "${CMP_NAM}" == 'all' ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit 192 193 194 ## No ref. cfg, demo case, nor remote cfg selected 195 if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" && -z "${RMT_CONF}" ]]; then 196 conf_file='work_cfgs.txt' 197 198 ## Reuse last configuration compiled if any (existing 'work_cfgs.txt') 199 if [[ $( find ./cfgs ./tests -name work_cfgs.txt ) ]]; then 200 CONFIG_DIR=${MAIN_DIR}/$( ls -rt */work_cfgs.txt | awk -F/ 'END{ print $1}' ) 201 TML_CONF=$( tail -1 ${CONFIG_DIR}/${conf_file} | awk '{ print $1 }' ) 202 else 203 ## No ${REF_CONF}, ${DEMO_CONF}, ${RMT_CONF} nor ${NEM_SUBDIR} and 1st compilation => exit 204 echo -e "\033[0;33m\nNo previous compilation found!" 205 echo -e "\033[0;31m\nAt least a reference configuration ('-r'), a demonstration case ('-a'), " 206 echo -e "a remote configuration ('-u') or a set of NEMO sub-components ('-d') " 207 echo -e "has to be choose!!!\033[0m" 208 ${COMPIL_DIR}/Flist_cfgs.sh 209 exit 2 210 fi 211 212 ## At least one config has been requested 310 213 else 311 sed -e "/${NEW_CONF} /d" ${CONFIG_DIR}/cfg.txt > ${COMPIL_DIR}/cfg.tmp 312 \mv ${COMPIL_DIR}/cfg.tmp ${CONFIG_DIR}/cfg.txt 313 fi 314 315 #- 316 #- Save new configuration and directories names --- 317 echo ${NEW_CONF} ${TAB[*]} >> ${CONFIG_DIR}/cfg.txt 318 319 #- 214 215 ## Argument 'all': list all available configurations 216 if [[ "${REF_CONF}" == 'all' || "${DEMO_CONF}" == 'all' || "${RMT_CONF}" == 'all' ]]; then 217 ${COMPIL_DIR}/Flist_cfgs.sh 218 exit 2 219 elif [[ -n "${REF_CONF}" && -n "${DEMO_CONF}" ]]; then 220 echo -e "\033[0;31m\nYou have to choose whether you work with:" 221 echo -e " - Supported reference configurations in ./cfgs ('-r') or" 222 echo -e " - Unsupported demonstration cases in ./tests ('-a')\033[0m\n" 223 exit 2 224 fi 225 226 ## Remote cfg 227 if [ -n "${RMT_CONF}" ]; then 228 conf_file='rmt_cfgs.txt' ; CONFIG_DIR=${MAIN_DIR}/tests; 229 230 ## Little tricky this one 231 for word in $( grep ${RMT_CONF} ${CONFIG_DIR}/${conf_file} ); do 232 words[${#words[@]}]=$word 233 done 234 235 TML_CONF=${words[2]}; NEM_SUBDIR=${words[4]}; URL=${words[6]} 236 237 ## Demo case 238 elif [ -n "${DEMO_CONF}" ]; then 239 conf_file='demo_cfgs.txt'; CONFIG_DIR=${MAIN_DIR}/tests; TML_CONF=${DEMO_CONF} 240 fi 241 242 fi 243 244 ## Test if ref. cfg or demo case does exist 245 if [[ ! $( grep "${TML_CONF} " ${CONFIG_DIR}/*_cfgs.txt ) ]]; then 246 echo -e "\033[0;31m\nThe reference configuration ('-r'), demonstration case ('-a') or " 247 echo -e "remote configuration ('-u') selected is not available!!!" 248 echo -e "Check if you use the good option and the available items in txt files\033[0m" 249 ${COMPIL_DIR}/Flist_cfgs.sh 250 exit 2 251 252 ## Update sub-comps if needed 253 elif [ -z "${NEM_SUBDIR}" ]; then 254 ## First check working cfgs file 255 256 if [ -f ${CONFIG_DIR}/work_cfgs.txt ]; then 257 NEM_SUBDIR=$( grep "${TML_CONF} " ${CONFIG_DIR}/work_cfgs.txt | awk '{$1 = ""; print $0}' ) 258 fi 259 260 ## Then versioned cfg files 261 if [ -z "${NEM_SUBDIR}" ]; then 262 NEM_SUBDIR=$( grep "${TML_CONF} " ${CONFIG_DIR}/${conf_file} | awk '{$1 = ""; print $0}' ) 263 fi 264 265 fi 266 267 [ -z "${NEW_CONF}" ] && NEW_CONF=${TML_CONF} 268 export NEMO_TDIR=${x_t:-$CONFIG_DIR} 269 270 ## Save new configuration with sub-components set in work_cfgs.txt 271 [ -f ${CONFIG_DIR}/work_cfgs.txt ] && sed -i "/${NEW_CONF} /d" ${CONFIG_DIR}/work_cfgs.txt 272 echo ${NEW_CONF} "${NEM_SUBDIR}" \ 273 >> ${CONFIG_DIR}/work_cfgs.txt 274 275 cd ${CONFIG_DIR} 276 277 printf "\nYou are installing a new configuration %s from %s " ${NEW_CONF} ${TML_CONF} 278 printf "with sub-components: %s\n" "${NEM_SUBDIR}" 279 280 ## Build a copy of a tmp cfg 281 [ ! -d ${NEW_CONF} ] && ${COMPIL_DIR}/Fmake_config.sh ${NEW_CONF} ${TML_CONF} 282 283 ## Get online script file for remote cfg 284 [ -n "${RMT_CONF}" ] && ${COMPIL_DIR}/Ffetch_extdir.sh ${NEW_CONF} $URL 285 320 286 #- Create the WORK --- 321 287 #- Clean links and librairies --- 322 288 #- Creating the good links, at first on OCE --- 323 . ${COMPIL_DIR}/Fmake_WORK.sh ${x_e} ${NEW_CONF} ${ TAB[*]} || exit 3324 325 . ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF} 289 . ${COMPIL_DIR}/Fmake_WORK.sh ${x_e} ${NEW_CONF} ${NEM_SUBDIR} || exit 3 290 291 . ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF} ${NEMO_TDIR} || exit 3 326 292 327 293 # build the complete list of the cpp keys of this configuration 328 if [ $ chk_key-eq 1 ] ; then329 for i in $( grep "^ *#.* key_" ${NEW_CONF}/WORK/* ) 330 331 echo $i | grep key_ | sed -e "s/=.*//"332 done | sort -d | uniq > ${COMPIL_DIR}/full_key_list.txt 333 if [ $list_key -eq 1 ]; then 334 cat ${COMPIL_DIR}/full_key_list.txt 335 exit 0336 fi 294 if [ ${chk_key} -eq 1 ] ; then 295 296 for i in $( grep "^ *#.* key_" ${NEW_CONF}/WORK/* ); do 297 echo $i | grep key_ | sed -e "s/=.*//" 298 done \ 299 | sort -d | uniq > ${COMPIL_DIR}/full_key_list.txt 300 301 [ ${list_key} -eq 1 ] && cat ${COMPIL_DIR}/full_key_list.txt && exit 0 302 337 303 fi 338 304 … … 343 309 #- check that all keys are really existing... 344 310 if [ $chk_key -eq 1 ] ; then 345 for kk in $( cat ${NEW_CONF}/cpp_${NEW_CONF}.fcm ) 346 do 347 if [ "$( echo $kk | cut -c 1-4 )" == "key_" ]; then 348 kk=${kk/=*/} 349 nb=$( grep -c $kk ${COMPIL_DIR}/full_key_list.txt ) 350 if [ $nb -eq 0 ]; then 351 echo 352 echo "E R R O R : key "$kk" is not found in ${NEW_CONF}/WORK routines..." 353 echo "we stop..." 354 echo 355 exit 1 356 fi 357 fi 358 done 311 312 for kk in $( cat ${NEW_CONF}/cpp_${NEW_CONF}.fcm ); do 313 314 if [ "$( echo $kk | cut -c 1-4 )" == "key_" ]; then 315 kk=${kk/=*/} 316 317 if [ ! $( grep $kk ${COMPIL_DIR}/full_key_list.txt ) ]; then 318 echo 319 echo "E R R O R : key "$kk" is not found in ${NEW_CONF}/WORK routines..." 320 echo "we stop..." 321 echo 322 exit 1 323 fi 324 325 fi 326 327 done 328 359 329 fi 360 330 … … 379 349 380 350 if [ "${NBR_PRC}" -gt 0 ]; then 381 cd ${NEMO_TDIR}/${NEW_CONF} || cd - 382 383 #if AGRIF we do a first preprocessing 384 if [ ${#x_c} -eq 0 ]; then 385 if [ "$AGRIFUSE" == 1 ]; then 386 fcm build --ignore-lock -j 1 ${COMPIL_DIR}/bld_preproagr.cfg ||{ cd - ; exit 1 ;} 387 echo "" 388 echo "---------------------------------" 389 echo "CONV preprocessing successfull !!" 390 echo "---------------------------------" 391 echo "" 392 fi 393 fi 394 fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD ||{ cd - ; exit 1 ;} 395 [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ] && ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${CONFIG_DIR}/${NEW_CONF}/EXP00/nemo 396 397 #add remove for clean option 398 if [ ${#x_c} -ne 0 ]; then 399 rm -rf ${NEMO_TDIR}/${NEW_CONF}/NEMOFILES 400 rm -rf ${NEMO_TDIR}/${NEW_CONF}/WORK 401 rm -rf ${NEMO_TDIR}/${NEW_CONF}/BLD 402 rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/nemo 403 rm -f ${COMPIL_DIR}/*history ${COMPIL_DIR}/*fcm ${COMPIL_DIR}/*txt 404 echo "cleaning ${NEW_CONF} WORK, BLD" 405 fi 351 cd ${NEMO_TDIR}/${NEW_CONF} || cd - 352 353 ## if AGRIF we do a first preprocessing 354 if [[ ${#x_c} -eq 0 && "$AGRIFUSE" -eq 1 ]]; then 355 fcm build --ignore-lock -j 1 ${COMPIL_DIR}/bld_preproagr.cfg ||{ cd - ; exit 1 ;} 356 echo '' 357 echo "---------------------------------" 358 echo "CONV preprocessing successfull !!" 359 echo "---------------------------------" 360 echo '' 361 fi 362 363 fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD ||{ cd - ; exit 1 ;} 364 365 if [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ]; then 366 ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${CONFIG_DIR}/${NEW_CONF}/EXP00/nemo 367 fi 368 369 ## add remove for clean option 370 if [ ${#x_c} -ne 0 ]; then 371 rm -rf ${NEMO_TDIR}/${NEW_CONF}/NEMOFILES 372 rm -rf ${NEMO_TDIR}/${NEW_CONF}/WORK 373 rm -rf ${NEMO_TDIR}/${NEW_CONF}/BLD 374 rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/nemo 375 rm -f ${COMPIL_DIR}/*history ${COMPIL_DIR}/*fcm ${COMPIL_DIR}/*txt 376 echo "cleaning ${NEW_CONF} WORK, BLD" 377 fi 406 378 407 379 fi … … 413 385 #- Unset variables 414 386 ${COMPIL_DIR}/Fclean_var.sh 415 416 -
utils/build/mk/Fclean_config.sh
r9598 r9651 63 63 # 64 64 #- 65 NEW_CONF=${x_n} 66 if [ ${#NEW_CONF} -eq 0 ] ; then 67 echo " " 68 echo "No configuration specified, please use makenemo -n CONFIG clean_config " 69 else 70 echo "Are you sure that you want to remove this directory $NEW_CONF? [y/n] " 71 read answer 72 answer=`echo $answer | sed 's/^[y].*$/y/'` 73 if [ -z "$answer" -o "x$answer" = "xy" ]; then 74 # testing if configuration exists 75 if [ "$(cat ${CONFIG_DIR}/cfg.txt | grep "${NEW_CONF} ")" == "" ] ; then 76 echo "The configuration ${NEW_CONF} does not exist in file cfg.txt" 77 echo "No removing configuration" 78 echo " " 79 else 80 rm -rf ${CONFIG_DIR}/${NEW_CONF} 81 sed -e "/${NEW_CONF} /d" ${CONFIG_DIR}/cfg.txt > ${CONFIG_DIR}/cfg.tmp 82 mv ${CONFIG_DIR}/cfg.tmp ${CONFIG_DIR}/cfg.txt 83 echo "${NEW_CONF} configuration REMOVED" 84 fi 85 else 86 echo " " 87 echo "nothing to remove" 88 fi 89 fi 90 unset -v answer 65 66 NEW_CONF=${x_n} 67 68 if [ ${#NEW_CONF} -eq 0 ] ; then 69 echo " " 70 echo "No configuration specified, please use makenemo -n CONFIG clean_config " 71 else 72 echo "Are you sure that you want to remove this directory $NEW_CONF? [y/n] " 73 read answer 74 answer=`echo $answer | sed 's/^[y].*$/y/'` 75 76 if [ -z "$answer" -o "x$answer" = "xy" ]; then 77 78 ## testing if configuration exists 79 if [[ ! $( grep "${NEW_CONF} " */work_cfgs.txt ) ]] ; then 80 echo "The configuration ${NEW_CONF} does not exist in file work_cfgs.txt" 81 echo "No removing configuration" 82 echo " " 83 else 84 CONFIG_DIR=${MAIN_DIR}/$( grep -l "${NEW_CONF} " */work_cfgs.txt | cut -d/ -f1 ) 85 rm -rf ${CONFIG_DIR}/${NEW_CONF} 86 sed -e "/${NEW_CONF} /d" ${CONFIG_DIR}/work_cfgs.txt > ${CONFIG_DIR}/work_cfgs.tmp 87 mv ${CONFIG_DIR}/work_cfgs.tmp ${CONFIG_DIR}/work_cfgs.txt 88 echo "${NEW_CONF} configuration REMOVED" 89 fi 90 91 else 92 echo " " 93 echo "nothing to remove" 94 fi 95 96 fi 97 98 unset -v answer -
utils/build/mk/Flist_archfile.sh
r9598 r9651 56 56 #- 57 57 58 if [ -n "$2" ]; then 59 shift 60 fi 58 archfile_loop() { 61 59 62 echo "Available compilers for -m option :" 63 for file in $(ls ${MAIN_DIR}/arch | grep "fcm$" ) 64 do 65 zvar1=${file#arch-} 66 zvar2=$(head -1 ${MAIN_DIR}/arch/$file) 67 #echo "${zvar1%.fcm} : ${zvar2#\#}" 68 printf "%-20s %s %-s\n" "${zvar1%.fcm}" : "${zvar2#\#}" 60 for file in $( ls $1/*.fcm ); do 61 zvar1=$( basename $file | sed 's/arch-\(.*\).fcm/\1/' ) 62 zvar2=$( head -1 $file | tr -d '#' ) 63 printf "%-30s %-s\n" ${zvar1} "${zvar2}" 64 done 65 66 } 67 68 echo -e "\n ¤ Generic computing architectures" 69 70 archfile_loop ${MAIN_DIR}/arch 71 72 for dir in $( ls ${MAIN_DIR}/arch | grep -v "fcm$" ); do 73 echo -e "\n ¤ Specific HPC architectures for "${dir} 74 archfile_loop ${MAIN_DIR}/arch/$dir 69 75 done 70 76 71 72 if [ "$1" == "all" ]; then 73 for dir in $(ls ${MAIN_DIR}/arch | grep -v "fcm$" ) 74 do 75 echo "Available compilers at ${dir} :" 76 for file in $(ls ${MAIN_DIR}/arch/${dir} | grep "fcm$" ) 77 do 78 zvar1=${file#arch-} 79 zvar2=$(head -1 ${MAIN_DIR}/arch/${dir}/$file) 80 #echo "${zvar1%.fcm} : ${zvar2#\#}" 81 printf "%-20s %s %-s\n" "${zvar1%.fcm}" : "${zvar2#\#}" 82 done 83 done 84 elif [ -d ${MAIN_DIR}/arch/${1} ]; then 85 echo "Available compilers at $1 :" 86 for file in $(ls ${MAIN_DIR}/arch/$1 | grep "fcm$" ) 87 do 88 zvar1=${file#arch-} 89 zvar2=$(head -1 ${MAIN_DIR}/arch/${1}/$file) 90 #echo "${zvar1%.fcm} : ${zvar2#\#}" 91 printf "%-20s %s %-s\n" "${zvar1%.fcm}" : "${zvar2#\#}" 92 done 93 else 94 echo "Available consortium member sub-directories :" 95 for dir in $(ls ${MAIN_DIR}/arch | grep -v "fcm$" ) 96 do 97 echo ${dir} 98 done 99 echo "use \"makenemo -h all\" or \"makenemo -m help\" to see compilers available in member's sub-directories" 100 fi 77 echo -
utils/build/mk/Fmake_WORK.sh
r9598 r9651 69 69 declare i=0 ; declare NDIR=${#ZTAB[@]} 70 70 71 echo "Creating ${ZCONF}/WORK = ${ZTAB[*]} for ${ZCONF}"71 echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF} 72 72 73 73 [ ! -d ${ZCONF}/MY_SRC ] && \mkdir ${ZCONF}/MY_SRC 74 74 [ -d ${ZCONF}/WORK ] || \mkdir ${ZCONF}/WORK 75 75 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 76 if [ "${ZSRC}" != 'none' ] ; then 77 78 if [ -d ${ZSRC} ] ; then 79 ln -sf ${ZSRC}/*.[Ffh]90 ${ZCONF}/MY_SRC/. 80 echo 'MY_SRC content is linked to '${ZSRC} 81 else 82 echo 'External directory for MY_SRC does not exist. Using default.' 83 fi 84 83 85 else 84 echo "MY_SRC directory is : ${ZCONF}/MY_SRC" 86 echo 'MY_SRC directory is : '${ZCONF}'/MY_SRC' 85 87 fi 86 88 87 \rm -f ../${1}/WORK/*89 #\rm -f ../${1}/WORK/* 88 90 89 while [ $i -lt $NDIR ] 90 do 91 [ "${ZTAB[i]}" = "OCE" ] && ln -sf ${NEMO_DIR}/OCE/*.[Ffh]90 ${ZCONF}/WORK 92 [ "${ZTAB[i]}" = "OCE" ] && ln -sf ${NEMO_DIR}/OCE/*/*.[Ffh]90 ${ZCONF}/WORK && break 93 let i=$i+1 91 for comp in ${ZTAB[*]}; do 92 find ${NEMO_DIR}/$comp -name *.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \; 94 93 done 95 94 96 i=0 97 while [ $i -lt $NDIR ] 98 do 99 if [ "${ZTAB[i]}" != "OCE" ]; then 100 ln -sf ${NEMO_DIR}/${ZTAB[i]}/*.[Ffh]90 ${ZCONF}/WORK 101 ln -sf ${NEMO_DIR}/${ZTAB[i]}/*/*.[Ffh]90 ${ZCONF}/WORK 102 ln -sf ${NEMO_DIR}/${ZTAB[i]}/*/*/*.[Ffh]90 ${ZCONF}/WORK 2>/dev/null 103 fi 104 let i=$i+1 95 for i in `(cd ${ZCONF}/MY_SRC ; \ls *.[Ffh]90 2>/dev/null ) `; do 96 [ -f ${ZCONF}/MY_SRC/$i ] && ln -sf $PWD/${ZCONF}/MY_SRC/${i} ${ZCONF}/WORK/. 105 97 done 106 98 107 for i in `(cd ${ZCONF}/MY_SRC ; \ls *.[Ffh]90 2>/dev/null ) ` 108 do 109 [ -f ${ZCONF}/MY_SRC/$i ] && ln -sf $PWD/${ZCONF}/MY_SRC/${i} ${ZCONF}/WORK/. 110 done 111 112 unset -v ZCONF 113 unset -v ZTAB 114 unset -v i 115 unset -v NDIR 116 99 unset -v ZCONF ZTAB i NDIR -
utils/build/mk/Fmake_bld.sh
r9598 r9651 58 58 # 59 59 #- 60 [ ! -d ${3}/${2} ] && \mkdir${3}/${2}61 [ ! -d ${3}/${2}/BLD ] && \mkdir 62 [ ! -d ${1}/${2}/BLD ] 60 [ ! -d ${3}/${2} ] && \mkdir ${3}/${2} 61 [ ! -d ${3}/${2}/BLD ] && \mkdir ${3}/${2}/BLD 62 [ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD 63 63 [ -f ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ] && ln -sf ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ${COMPIL_DIR}/cpp.fcm 64 64 rm -f ${1}/${NEW_CONF}/BLD/fcm.bld.lock
Note: See TracChangeset
for help on using the changeset viewer.