New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 4148 for branches/2013/dev_LOCEAN_2013/NEMOGCM/CONFIG/makenemo – NEMO

Ignore:
Timestamp:
2013-11-04T13:54:28+01:00 (11 years ago)
Author:
cetlod
Message:

merge in trunk changes between r3853 and r3940 and commit the changes, see ticket #1169

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2013/dev_LOCEAN_2013/NEMOGCM/CONFIG/makenemo

    r3764 r4148  
    106106export AGRIFUSE=10 
    107107declare -a TAB 
     108list_key=0 
     109chk_key=1 
    108110#- 
    109111#- FCM and functions location --- 
     
    112114#- 
    113115#- Choice of the options --- 
    114 while getopts :hd:n:r:m:j:e:s:v:t: V 
     116while getopts :hd:n:r:m:j:e:s:v:t:k: V 
    115117do 
    116118    case $V in 
    117119   (h) x_h=${OPTARG}; 
    118120        echo "Usage   : "${b_n} \ 
    119        " [-h] [-n name] [-m arch] [-d "dir1 dir2"] [-r conf] [-s Path] [-e Path] [-j No] [-v No]"; 
     121       " [-h] [-n name] [-m arch] [-d "dir1 dir2"] [-r conf] [-s Path] [-e Path] [-j No] [-v No] [-k 0/1]"; 
    120122   echo " -h           : help"; 
    121123   echo " -h institute : specific help for consortium members"; 
     
    128130        echo " -j No        : number of processes used to compile (0=nocompilation)"; 
    129131        echo " -v No        : set verbosity level for compilation [0-3]"; 
     132        echo " -k 0/1       : used cpp keys check (default = 1 -> check activated)"; 
    130133   echo " -t dir       : temporary directory for compilation" 
    131134   echo ""; 
     
    141144   echo "Example to clean "; 
    142145   echo "./makenemo clean"; 
     146   echo ""; 
     147   echo "Example to list the available keys of a CONFIG "; 
     148   echo "./makenemo list_key"; 
    143149   echo ""; 
    144150   echo "Example to add and remove keys"; 
     
    158164   (j)  x_j=${OPTARG};; 
    159165   (t)  x_t=${OPTARG};; 
    160     (e)  x_e=${OPTARG};; 
    161     (s)  x_s=${OPTARG};; 
    162     (v)  x_v=${OPTARG};; 
     166   (e)  x_e=${OPTARG};; 
     167   (s)  x_s=${OPTARG};; 
     168   (v)  x_v=${OPTARG};; 
     169   (k)  chk_key=${OPTARG};; 
    163170   (:)  echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2; 
    164171   exit 2;; 
     
    188195       export ${list_del_key} 
    189196       shift 
     197       ;; 
     198   list_key) 
     199       list_key=1 
    190200       ;; 
    191201   *) 
     
    222232[ "${CMP_NAM}" ==  help ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit 
    223233 
    224 #- When used for the first time, choose a compiler --- 
    225 . ${COMPIL_DIR}/Fcheck_archfile.sh arch_nemo.fcm ${CMP_NAM} || exit 
    226  
    227234#- 
    228235#- Choose a default configuration if needed --- 
    229236#- ORCA2_LIM or last one used --- 
    230237. ${COMPIL_DIR}/Fcheck_config.sh cfg.txt ${NEW_CONF} || exit 
    231  
    232238 
    233239if [ ${#NEW_CONF} -eq 0 ] ; then 
     
    269275. ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF}  ${NEMO_TDIR} || exit 
    270276 
     277# build the complete list of the cpp keys of this configuration 
     278if [ $chk_key -eq 1 ] ; then 
     279    for i in $( grep "^ *#.* key_" ${NEW_CONF}/WORK/* )  
     280    do 
     281   echo $i | grep key_ | sed -e "s/=.*//" 
     282    done | sort -d | uniq > ${COMPIL_DIR}/full_key_list.txt 
     283    if [ $list_key -eq 1 ]; then 
     284   cat ${COMPIL_DIR}/full_key_list.txt 
     285   exit 0 
     286    fi 
     287fi 
     288 
    271289#- At this stage new configuration has been added, 
    272290#- We add or remove keys 
     
    278296    . ${COMPIL_DIR}/Fdel_keys.sh ${NEW_CONF} del_key ${list_del_key} 
    279297fi 
     298 
     299#- check that all keys are really existing... 
     300if [ $chk_key -eq 1 ] ; then 
     301    for kk in $( cat ${NEW_CONF}/cpp_${NEW_CONF}.fcm ) 
     302    do 
     303   if [ "$( echo $kk | cut -c 1-4 )" == "key_" ]; then 
     304       kk=${kk/=*/} 
     305       nb=$( grep -c $kk ${COMPIL_DIR}/full_key_list.txt ) 
     306       if [ $nb -eq 0 ]; then 
     307      echo 
     308      echo "E R R O R : key "$kk" is not found in ${NEW_CONF}/WORK routines..." 
     309      echo "we stop..." 
     310      echo 
     311      exit 1 
     312       fi 
     313   fi 
     314    done 
     315fi 
     316 
     317#- At this stage cpp keys have been updated. we can check the arch file 
     318#- When used for the first time, choose a compiler --- 
     319. ${COMPIL_DIR}/Fcheck_archfile.sh arch_nemo.fcm cpp.fcm ${CMP_NAM} || exit 
    280320 
    281321#- At this stage the configuration has beeen chosen 
     
    317357        rm -rf ${NEMO_TDIR}/${NEW_CONF}/BLD 
    318358        rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/opa 
     359        rm -f ${COMPIL_DIR}/*history ${COMPIL_DIR}/*fcm ${COMPIL_DIR}/*txt 
    319360        echo "cleaning ${NEW_CONF} WORK, BLD" 
    320361    fi 
Note: See TracChangeset for help on using the changeset viewer.