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 9651 – NEMO

Changeset 9651


Ignore:
Timestamp:
2018-05-28T08:47:14+02:00 (6 years ago)
Author:
nicolasmartin
Message:

Reorganisation plan for NEMO repository: add missing modifications from previous commit

Location:
utils/build
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • utils/build/makenemo

    r9623 r9651  
    4141# - CMP_NAM     : compiler name 
    4242# - NBR_PRC     : number of processes used to compile 
    43 # - USP_CONF    : unsupported (external) configuration to build the new one from 
     43# - RMT_CONF    : unsupported (external) configuration to build the new one from 
    4444# - NEM_SUBDIR  : NEMO subdirectory used (specified) 
    4545# 
     
    6363# :: 
    6464# 
    65 #  $ ./makenemo -m ifort_osx - j3 -n ORCA2_LIM3_PISCES 
     65#  $ ./makenemo -m ifort_osx - j3 -n ORCA2_SI3_PISCES 
    6666# 
    6767# 
     
    8484 
    8585#- 
    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 --- 
     87x_d=''; x_h=''; x_n=''; x_r=''; 
     88x_u=''; x_a=''; x_m=''; x_t=''; 
     89x_c=''; 
     90x_j='1'; x_e='none'; x_s='src'; x_v='1' 
     91 
     92##- Local variables --- 
    10293b_n=$(basename ${0}) 
    103 OPTIND=1 
     94OPTIND='1' 
    10495MAIN_DIR=$(cd $(dirname "$0"); pwd) 
    105 MAIN_DIR=${MAIN_DIR%/SETTE*} 
     96MAIN_DIR=${MAIN_DIR%/sette*} 
    10697MAIN_DIR=${MAIN_DIR%/tools*} 
    10798MAIN_DIR=${MAIN_DIR%/cfgs*} 
     
    112103export COMPIL_DIR=${MAIN_DIR}/mk 
    113104export 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 
     105export AGRIFUSE='10' 
     106list_key='0'; chk_key='1' 
     107list_add_key=''; list_del_key=''; 
     108conf_file='ref_cfgs.txt' 
    120109#- 
    121110#- FCM and functions location --- 
     
    124113#- 
    125114#- 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 
     115while getopts :hd:n:r:u:a:m:j:e:s:v:t:k: option; do 
     116 
     117   case $option in 
     118      ('h') cat <<EOF 
     119Usage: 
     120------ 
     121./makenemo -[adru] ... -m ... [-h] [-[dejntv] ...] [{list_key,clean,clean_config}] [{add_key,del_key} ...] 
     122 
     123The previous build is reused by default if no given options 
     124 
     125Mandatory: '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 
     131Optional: 
     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 
     140Examples: 
     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 
     150EOF 
     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 
    195160done 
     161 
    196162shift $(($OPTIND-1)); 
    197163 
    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 
     165while [ ${#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 
    228178done 
    229179 
    230180 
    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 ]; then 
    239  if [ -d ${CONFIG_DIR}/${ALT_DIR} ]; then 
    240    export CONFIG_DIR=${CONFIG_DIR}/${ALT_DIR} 
    241 #- 
    242 #- Go to named subdirectory of the NEMOGCM/cfgs directory --- 
    243    cd ${CONFIG_DIR} 
    244  fi 
    245 fi 
    246181export NEW_CONF=${x_n} 
    247182NBR_PRC=${x_j} 
     
    249184NEM_SUBDIR=${x_d} 
    250185REF_CONF=${x_r} 
    251 USP_CONF=${x_u} 
    252 NEMO_TDIR=${x_t} 
    253 export NEMO_TDIR=${NEMO_TDIR:-$CONFIG_DIR} 
     186DEMO_CONF=${x_a} 
     187RMT_CONF=${x_u} 
     188TML_CONF=${REF_CONF} 
    254189export NEMO_DIR=${MAIN_DIR}/${x_s} 
    255190 
    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 
     195if [[ -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 
    310213else 
    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 
     242fi 
     243 
     244## Test if ref. cfg or demo case does exist 
     245if [[ ! $( 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 
     253elif [ -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 
     265fi 
     266 
     267[ -z "${NEW_CONF}" ] && NEW_CONF=${TML_CONF} 
     268export 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 
     272echo ${NEW_CONF} "${NEM_SUBDIR}" \ 
     273   >> ${CONFIG_DIR}/work_cfgs.txt 
     274 
     275cd ${CONFIG_DIR} 
     276 
     277printf "\nYou are installing a new configuration %s from %s " ${NEW_CONF} ${TML_CONF} 
     278printf  "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 
    320286#- Create the WORK --- 
    321287#- Clean links and librairies --- 
    322288#- Creating the good links, at first on OCE --- 
    323 . ${COMPIL_DIR}/Fmake_WORK.sh ${x_e} ${NEW_CONF} ${TAB[*]} || exit 3 
    324  
    325 . ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF}  ${NEMO_TDIR} || exit 3 
     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 
    326292 
    327293# build the complete list of the cpp keys of this configuration 
    328 if [ $chk_key -eq 1 ] ; then 
    329     for i in $( grep "^ *#.* key_" ${NEW_CONF}/WORK/* )  
    330     do 
    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 0 
    336     fi 
     294if [ ${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 
    337303fi 
    338304 
     
    343309#- check that all keys are really existing... 
    344310if [ $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 
    359329fi 
    360330 
     
    379349 
    380350if [ "${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 
    406378 
    407379fi 
     
    413385#- Unset variables 
    414386${COMPIL_DIR}/Fclean_var.sh 
    415  
    416  
  • utils/build/mk/Fclean_config.sh

    r9598 r9651  
    6363# 
    6464#- 
    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 
     66NEW_CONF=${x_n} 
     67 
     68if [ ${#NEW_CONF} -eq 0 ] ; then 
     69   echo " " 
     70   echo "No configuration specified, please use makenemo -n CONFIG clean_config " 
     71else 
     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 
     96fi  
     97 
     98unset -v answer 
  • utils/build/mk/Flist_archfile.sh

    r9598 r9651  
    5656#- 
    5757 
    58 if [ -n "$2" ]; then 
    59 shift 
    60 fi 
     58archfile_loop() { 
    6159 
    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 
     68echo -e "\n  ¤ Generic computing architectures" 
     69 
     70archfile_loop ${MAIN_DIR}/arch 
     71 
     72for 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 
    6975done 
    7076 
    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 
     77echo 
  • utils/build/mk/Fmake_WORK.sh

    r9598 r9651  
    6969declare i=0 ; declare NDIR=${#ZTAB[@]} 
    7070 
    71 echo "Creating ${ZCONF}/WORK = ${ZTAB[*]} for ${ZCONF}" 
     71echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF} 
    7272 
    7373[ ! -d ${ZCONF}/MY_SRC ] && \mkdir ${ZCONF}/MY_SRC 
    7474[   -d ${ZCONF}/WORK   ] || \mkdir ${ZCONF}/WORK 
    7575 
    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 
     76if [ "${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 
    8385else  
    84 echo "MY_SRC directory is : ${ZCONF}/MY_SRC" 
     86   echo 'MY_SRC directory is : '${ZCONF}'/MY_SRC' 
    8587fi 
    8688 
    87 \rm -f ../${1}/WORK/* 
     89#\rm -f ../${1}/WORK/* 
    8890 
    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 
     91for comp in ${ZTAB[*]}; do 
     92   find ${NEMO_DIR}/$comp -name *.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \; 
    9493done 
    9594 
    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 
     95for 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/. 
    10597done 
    10698 
    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  
     99unset -v ZCONF ZTAB i NDIR 
  • utils/build/mk/Fmake_bld.sh

    r9598 r9651  
    5858# 
    5959#- 
    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 
     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 
    6363[ -f ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ] && ln -sf ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ${COMPIL_DIR}/cpp.fcm 
    6464rm -f  ${1}/${NEW_CONF}/BLD/fcm.bld.lock 
Note: See TracChangeset for help on using the changeset viewer.