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 3925 for trunk – NEMO

Changeset 3925 for trunk


Ignore:
Timestamp:
2013-06-15T09:45:59+02:00 (11 years ago)
Author:
smasson
Message:

trunk:compilation enhancements, bugfix of changeset r3922, see ticket #1117

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/TOOLS/COMPILE/Fcheck_archfile.sh

    r3922 r3925  
    7575} 
    7676# cleaning related to the old version 
    77 myarch=$( find ${MAIN_DIR}/ARCH -type l -name arch-${3}.fcm -print ) 
    78 [ ${#myarch} -ne 0 ] && rm -f $myarch 
     77rm -f $( find ${COMPIL_DIR} -type l -name $1 -print ) 
    7978# 
    8079if [ ${#3} -eq 0 ]; then # arch not specified 
     
    9594   else 
    9695       if [ -f ${COMPIL_DIR}/$1 ]; then 
     96      # has the cpp keys file been changed since we copied the arch file in ${COMPIL_DIR}? 
     97      mycpp=$( ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" ) 
     98      if [ "$mycpp" != "$( cat ${COMPIL_DIR}/cpp.history )" ]; then 
     99          echo $mycpp > ${COMPIL_DIR}/cpp.history 
     100          cpeval ${myarch} ${COMPIL_DIR}/$1 
     101      fi 
     102      # has the cpp keys file been updated since we copied the arch file in ${COMPIL_DIR}? 
     103      mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print ) 
     104      [ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
     105      # has myarch file been updated since we copied it in ${COMPIL_DIR}? 
    97106      myarchdir=$( dirname ${myarch} ) 
    98107      myarchname=$( basename ${myarch} ) 
    99       # have the cpp keys been updated since we copy the arch file in ${COMPIL_DIR}? 
    100       mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print ) 
    101       [ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
    102       # has myarch been updated since we copy it in ${COMPIL_DIR}? 
    103108      myarch=$( find -L $myarchdir -cnewer ${COMPIL_DIR}/$1 -name $myarchname -print ) 
    104109      [ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
     
    109114    fi 
    110115else  
    111     myarch=$( find ${MAIN_DIR}/ARCH -name arch-${3}.fcm -print ) 
    112     if [ ${#myarch} -gt 0 ]; then # the arch file specified by the use exists 
    113    # we were already using this arch file 
    114    if [ "$myarch" == "$( cat ${COMPIL_DIR}/arch.history )" ]; then  
    115        if [ -f ${COMPIL_DIR}/$1 ]; then 
    116          # have the cpp keys been updated since we copy the arch file in ${COMPIL_DIR}? 
    117       mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print ) 
    118       [ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
    119       # has myarch been updated since we copy it in ${COMPIL_DIR}? 
    120       myarch=$( find -L ${MAIN_DIR}/ARCH -cnewer ${COMPIL_DIR}/$1 -name arch-${3}.fcm -print ) 
    121       [ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
    122        else 
    123       cpeval ${myarch} ${COMPIL_DIR}/$1 
    124        fi 
    125    else 
    126        echo ${myarch} > ${COMPIL_DIR}/arch.history 
    127        cpeval ${myarch} ${COMPIL_DIR}/$1 
    128    fi 
    129     else 
     116    nb=$( find ${MAIN_DIR}/ARCH -name arch-${3}.fcm -print | wc -l ) 
     117    if [ $nb -eq 0 ]; then # no arch file found 
    130118   echo "Warning !!!" 
    131119   echo "Compiler not existing" 
     
    133121   echo "EXITING..." 
    134122   exit 1        
    135     fi    
     123    fi 
     124    if [ $nb -gt 1 ]; then # more than 1 arch file found 
     125   echo "Warning !!!" 
     126   echo "more than 1 arch file for the same compiler have been found" 
     127   find ${MAIN_DIR}/ARCH -name arch-${3}.fcm -print 
     128   echo "keep only 1" 
     129   echo "EXITING..." 
     130   exit 1        
     131    fi 
     132    myarch=$( find ${MAIN_DIR}/ARCH -name arch-${3}.fcm -print ) 
     133    # we were already using this arch file ? 
     134    if [ "$myarch" == "$( cat ${COMPIL_DIR}/arch.history )" ]; then  
     135   if [ -f ${COMPIL_DIR}/$1 ]; then 
     136       # has the cpp keys file been changed since we copied the arch file in ${COMPIL_DIR}? 
     137       mycpp=$( ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" ) 
     138       if [ "$mycpp" != "$( cat ${COMPIL_DIR}/cpp.history )" ]; then 
     139      echo $mycpp > ${COMPIL_DIR}/cpp.history 
     140      cpeval ${myarch} ${COMPIL_DIR}/$1 
     141       fi 
     142       # has the cpp keys file been updated since we copied the arch file in ${COMPIL_DIR}? 
     143       mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print ) 
     144       [ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
     145       # has myarch file been updated since we copied it in ${COMPIL_DIR}? 
     146       myarch=$( find -L ${MAIN_DIR}/ARCH -cnewer ${COMPIL_DIR}/$1 -name arch-${3}.fcm -print ) 
     147       [ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
     148   else 
     149       cpeval ${myarch} ${COMPIL_DIR}/$1 
     150   fi 
     151    else 
     152   ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" > ${COMPIL_DIR}/cpp.history 
     153   echo ${myarch} > ${COMPIL_DIR}/arch.history 
     154   cpeval ${myarch} ${COMPIL_DIR}/$1 
     155    fi 
    136156fi 
    137157 
Note: See TracChangeset for help on using the changeset viewer.