- Timestamp:
- 2013-11-04T13:54:28+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2013/dev_LOCEAN_2013/NEMOGCM/TOOLS/COMPILE/Fcheck_archfile.sh
r3294 r4148 59 59 # 60 60 #- 61 cpeval () 62 { 63 cat > $2 << EOF 61 64 62 if [ ${#2} -eq 0 ]; then 63 if [ ! -f ${COMPIL_DIR}/$1 ]; then 64 echo "Warning !!!" 65 echo "NO compiler chosen" 66 echo "Try makenemo -h for help" 67 echo "EXITING..." 68 exit 1 69 fi 70 else 71 myfile=$( find ${MAIN_DIR}/ARCH -name arch-${2}.fcm -print ) 72 if [ ${#myfile} -gt 0 ]; then 73 ln -sf ${myfile} ${COMPIL_DIR}/$1 74 else 75 echo "Warning !!!" 76 echo "Compiler not existing" 77 echo "Try makenemo -h for help" 78 echo "EXITING..." 79 exit 1 80 fi 65 #========================================================== 66 # Automatically generated by Fcheck_archfile.sh from 67 # $1 68 #========================================================== 69 70 EOF 71 while read line 72 do 73 eval "echo \"$line\" >> $2" 74 done < $1 75 } 76 # cleaning related to the old version 77 rm -f $( find ${COMPIL_DIR} -type l -name $1 -print ) 78 # 79 if [ ${#3} -eq 0 ]; then # arch not specified 80 if [ ! -f ${COMPIL_DIR}/arch.history ]; then 81 echo "Warning !!!" 82 echo "NO compiler chosen" 83 echo "Try makenemo -h for help" 84 echo "EXITING..." 85 exit 1 86 else # use the arch file defined in arch.history 87 myarch=$( cat ${COMPIL_DIR}/arch.history ) 88 if [ ! -f $myarch ]; then 89 echo "Warning !!!" 90 echo "previously used arch file no more found:" 91 echo $myarch 92 echo "EXITING..." 93 exit 1 94 else 95 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}? 106 myarchdir=$( dirname ${myarch} ) 107 myarchname=$( basename ${myarch} ) 108 myarch=$( find -L $myarchdir -cnewer ${COMPIL_DIR}/$1 -name $myarchname -print ) 109 [ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 110 else 111 cpeval ${myarch} ${COMPIL_DIR}/$1 112 fi 113 fi 114 fi 115 else 116 nb=$( find ${MAIN_DIR}/ARCH -name arch-${3}.fcm -print | wc -l ) 117 if [ $nb -eq 0 ]; then # no arch file found 118 echo "Warning !!!" 119 echo "Compiler not existing" 120 echo "Try makenemo -h for help" 121 echo "EXITING..." 122 exit 1 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 81 156 fi 157 158 #- do we need xios library? 159 use_iom=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$2 | grep -c key_iomput ) 160 have_lxios=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-lxios" ) 161 if [[ ( $use_iom -eq 0 ) && ( $have_lxios -ge 1 ) ]] 162 then 163 sed -e "s/-lxios//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$ 164 mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1 165 fi 166 167 #- do we need oasis libraries? 168 use_oasis=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$2 | grep -c key_oasis3 ) 169 for liboa in psmile.MPI1 mct mpeu scrip mpp_io 170 do 171 have_liboa=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-l${liboa}" ) 172 if [[ ( $use_oasis -eq 0 ) && ( $have_liboa -ge 1 ) ]] 173 then 174 sed -e "s/-l${liboa}//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$ 175 mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1 176 fi 177 done 178
Note: See TracChangeset
for help on using the changeset viewer.