[524] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # $Header$ |
---|
| 4 | # |
---|
| 5 | #set -xv |
---|
| 6 | machine=`hostname` |
---|
| 7 | os=`uname` |
---|
| 8 | gcm=`pwd` |
---|
| 9 | libf=$gcm/libf |
---|
| 10 | libo=$gcm/libo |
---|
| 11 | CRAY=0 |
---|
| 12 | if [ "$machine" = "atlas" -o "$machine" = "etoile" -o "$machine" = "axis" ] ; then |
---|
| 13 | CRAY=1 |
---|
| 14 | fi |
---|
| 15 | XNEC=0 |
---|
| 16 | if [ "$machine" = "rhodes" ] ; then |
---|
| 17 | XNEC=1 |
---|
| 18 | fi |
---|
[536] | 19 | X6NEC=0 |
---|
| 20 | if [ "$machine" = "mercure" ] ; then |
---|
| 21 | X6NEC=1 |
---|
| 22 | fi |
---|
[768] | 23 | X8BRODIE=0 |
---|
| 24 | if [ "$machine" = "brodie" ] ; then |
---|
| 25 | X8BRODIE=1 |
---|
| 26 | fi |
---|
[524] | 27 | VPP=0 |
---|
| 28 | if [ "$machine" = "nymphea0" ] ; then |
---|
| 29 | VPP=1 |
---|
| 30 | fi |
---|
| 31 | # |
---|
| 32 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
| 33 | echo "# Definitions de Macros pour Make" |
---|
| 34 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
| 35 | echo |
---|
| 36 | echo "# Repertoires :" |
---|
| 37 | echo |
---|
| 38 | echo "GCM = "$gcm |
---|
| 39 | echo 'LIBF = $(GCM)/libf' |
---|
| 40 | if [ "$CRAY" = '0' ] ; then |
---|
| 41 | # echo 'LIBO = $(GCM)/libo/$(MACHINE)' |
---|
| 42 | echo 'LIBO = $(LIBOGCM)/$(MACHINE)' |
---|
| 43 | else |
---|
| 44 | echo 'LIBO = $(GCM)/libo' |
---|
| 45 | fi |
---|
| 46 | #echo 'LOCAL_DIR=$(GCM)' |
---|
| 47 | #echo $localdir |
---|
| 48 | echo "LOCAL_DIR=`echo $localdir`" |
---|
| 49 | echo 'BIBIO = $(LIBF)/bibio' |
---|
| 50 | echo "FILTRE = filtre" |
---|
| 51 | echo "PHYS = " |
---|
| 52 | echo "DYN = dyn " |
---|
| 53 | echo 'LIBPHY = $(LIBO)/libphy$(PHYS).a' |
---|
[768] | 54 | echo 'DIRMAIN=dyn$(DIM)d$(FLAG_PARA)' |
---|
[524] | 55 | echo 'RM=rm' |
---|
| 56 | echo |
---|
| 57 | echo "OPLINK = " |
---|
| 58 | echo |
---|
| 59 | echo '# Les differentes librairies pour l"edition des liens:' |
---|
| 60 | echo |
---|
[768] | 61 | if ( [ "$XNEC" = '1' ] || [ "$X6NEC" = '1' ] || [ "$X8BRODIE" = '1' ] ) ; then |
---|
[524] | 62 | echo 'dyn3d = $(LIBO)/libsxdyn3d.a $(LIBO)/libsx$(FILTRE).a' |
---|
[768] | 63 | echo 'dyn3dpar = $(LIBO)/libsxdyn3dpar.a $(LIBO)/libsx$(FILTRE).a' |
---|
[524] | 64 | echo 'dyn2d = $(LIBO)/libsxdyn2d.a' |
---|
| 65 | echo 'dyn1d = $(LIBO)/libsxdyn1d.a' |
---|
[768] | 66 | echo 'L_DYN = -lsxdyn$(DIM)d$(FLAG_PARA)' |
---|
[524] | 67 | echo 'L_FILTRE = -lsx$(FILTRE)' |
---|
| 68 | echo 'L_PHY = -lsxphy$(PHYS) ' |
---|
| 69 | echo 'L_BIBIO = -lsxbibio' |
---|
| 70 | echo 'L_ADJNT =' |
---|
[1279] | 71 | echo 'L_COSP = -lsxcosp' |
---|
[524] | 72 | else |
---|
[768] | 73 | echo 'dyn3d = $(LIBO)/libdyn3d.a $(LIBO)/lib$(FILTRE).a' |
---|
| 74 | echo 'dyn3dpar = $(LIBO)/libdyn3dpar.a $(LIBO)/lib$(FILTRE).a' |
---|
| 75 | echo 'dyn2d = $(LIBO)/libdyn2d.a' |
---|
| 76 | echo 'dyn1d = $(LIBO)/libdyn1d.a' |
---|
| 77 | echo 'L_DYN = -ldyn$(DIM)d$(FLAG_PARA)' |
---|
[524] | 78 | echo 'L_FILTRE = -l$(FILTRE)' |
---|
| 79 | echo 'L_PHY = -lphy$(PHYS) ' |
---|
| 80 | echo 'L_BIBIO = -lbibio' |
---|
| 81 | echo 'L_ADJNT =' |
---|
[1279] | 82 | echo 'L_COSP = -lcosp' |
---|
[524] | 83 | fi |
---|
[768] | 84 | |
---|
[524] | 85 | echo |
---|
| 86 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
| 87 | echo "# Option de compilation FORTRAN" |
---|
| 88 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
| 89 | echo |
---|
| 90 | echo 'COMPILE = $(F77) $(OPTIM) $(INCLUDE) -c' |
---|
| 91 | echo 'COMPILE90 = $(F90) $(OPTIM90) $(INCLUDE) -c' |
---|
| 92 | echo 'COMPTRU90 = $(F90) $(OPTIMTRU90) $(INCLUDE) -c' |
---|
| 93 | echo "LINK = $LINK" |
---|
| 94 | echo "AR = $AR" |
---|
| 95 | echo |
---|
| 96 | echo |
---|
| 97 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
| 98 | echo "# Creation des differents executables" |
---|
| 99 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
| 100 | echo |
---|
| 101 | echo "# Executables:" |
---|
| 102 | echo "# ------------" |
---|
| 103 | echo |
---|
| 104 | echo "PROG = code" |
---|
| 105 | echo |
---|
[768] | 106 | #echo 'main : chimie $(DYN) bibio phys $(OPTION_DEP) ' |
---|
| 107 | echo 'main : $(DYN) bibio phys $(OPTION_DEP) ' |
---|
[524] | 108 | echo ' cd $(LIBO) ; $(RANLIB) lib*.a ; cd $(GCM) ;\' |
---|
| 109 | echo ' cd $(LOCAL_DIR); \' |
---|
[1403] | 110 | echo ' $(COMPILE90) $(LIBF)/$(DIRMAIN)/$(SOURCE) -o $(PROG).o ; \' |
---|
[1279] | 111 | echo ' $(LINK) $(PROG).o -L$(LIBO) $(L_DYN) $(L_ADJNT) $(L_COSP) $(L_FILTRE) $(L_PHY) $(L_DYN) $(L_BIBIO) $(L_DYN) $(OPLINK) $(OPTION_LINK) -o $(LOCAL_DIR)/$(PROG).e ; $(RM) $(PROG).o ' |
---|
[524] | 112 | echo |
---|
[768] | 113 | echo 'dyn : $(LIBO)/libdyn$(DIM)d$(FLAG_PARA).a $(FILTRE)$(DIM)d' |
---|
[524] | 114 | echo |
---|
| 115 | echo 'phys : $(LIBPHY)' |
---|
| 116 | echo |
---|
[768] | 117 | #echo 'chimie : $(LIBO)/libchimie.a' |
---|
| 118 | echo |
---|
[524] | 119 | echo 'bibio : $(LIBO)/libbibio.a' |
---|
| 120 | echo |
---|
| 121 | echo 'adjnt : $(LIBO)/libadjnt.a' |
---|
| 122 | echo |
---|
[1279] | 123 | echo 'cosp : $(LIBO)/libcosp.a' |
---|
| 124 | echo |
---|
[524] | 125 | echo '$(FILTRE)3d : $(LIBO)/lib$(FILTRE).a' |
---|
| 126 | echo |
---|
| 127 | echo '$(FILTRE)2d :' |
---|
| 128 | echo |
---|
| 129 | echo '$(FILTRE)1d :' |
---|
| 130 | echo |
---|
| 131 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
| 132 | echo "# Contenu des differentes bibliotheques" |
---|
| 133 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
| 134 | echo |
---|
| 135 | echo |
---|
| 136 | cd $libf >/dev/null 2>&1 |
---|
| 137 | for diri in ` ls ` |
---|
| 138 | do |
---|
| 139 | if [ -d $diri ] ; then |
---|
| 140 | if [ "`ls $diri/*.F`" != "" ] || [ "`ls $diri/*.F90`" != "" ] ; then |
---|
| 141 | cd $diri >/dev/null 2>&1 |
---|
| 142 | echo |
---|
| 143 | listlib="" |
---|
| 144 | for i in `ls *.F` |
---|
| 145 | do |
---|
| 146 | fili=`basename $i .F` |
---|
| 147 | test=` ( head $i | grep ' PROGRAM' ) ` |
---|
| 148 | if [ "$test" = "" ] ; then |
---|
| 149 | listlib=$listlib" "$fili |
---|
| 150 | fi |
---|
| 151 | done |
---|
| 152 | for i in `ls *.F90` |
---|
| 153 | do |
---|
| 154 | fili=`basename $i .F90` |
---|
| 155 | test=` ( head $i | grep ' PROGRAM' ) ` |
---|
| 156 | if [ "$test" = "" ] ; then |
---|
| 157 | listlib=$listlib" "$fili |
---|
| 158 | fi |
---|
| 159 | done |
---|
| 160 | # |
---|
| 161 | echo |
---|
| 162 | echo |
---|
| 163 | echo "#=======================================================================" |
---|
| 164 | echo "# Contenu de la bibliotheque correspondant au Directory "$diri |
---|
| 165 | echo "#=======================================================================" |
---|
| 166 | echo |
---|
| 167 | for fili in $listlib |
---|
| 168 | do |
---|
| 169 | echo '$(LIBO)/lib'$diri".a : " '$(LIBO)/lib'$diri".a("$fili".o)" |
---|
| 170 | echo |
---|
| 171 | done |
---|
| 172 | echo '.PRECIOUS : $(LIBO)/lib'$diri'.a' |
---|
| 173 | echo |
---|
| 174 | echo |
---|
| 175 | echo "# Compilation des membres de la bibliotheque lib"$diri".a" |
---|
| 176 | echo |
---|
| 177 | for fili in $listlib |
---|
| 178 | do |
---|
| 179 | if [ -f $fili.F90 ] ; then |
---|
| 180 | trufile=$fili.F90 |
---|
| 181 | else |
---|
| 182 | trufile=$fili.F |
---|
| 183 | fi |
---|
| 184 | F90=0 ; egrep -i '^ *use ' $trufile > /dev/null 2>&1 && F90=1 |
---|
| 185 | egrep -i '^ *module ' $trufile > /dev/null 2>&1 && F90=1 |
---|
[536] | 186 | egrep -i '#include*.inc ' $trufile > /dev/null 2>&1 && F90=1 |
---|
[524] | 187 | str1='$(LIBO)/lib'$diri'.a('$fili'.o) : $(LIBF)/'$diri/$trufile |
---|
| 188 | [ "$fili" = "chem.subs" ] && str1=$str1' $(LIBF)/'$diri/chem.mods.F |
---|
[867] | 189 | for stri in ` ( sed -n "/\#include/s/\#include//p" $trufile | sed 's/\"//g' ; egrep -i '^ *use ' $trufile | sed -e 's/,/ /' | awk ' { print $2 } ' ) ` |
---|
[524] | 190 | do |
---|
[1112] | 191 | |
---|
| 192 | |
---|
| 193 | # Differents cas de dependance correspondant a des include ou des |
---|
| 194 | # use module. |
---|
| 195 | # soit dans le repertoire local soit dans un autre. |
---|
| 196 | |
---|
[524] | 197 | stri=`echo $stri | tr [A-Z] [a-z]` |
---|
| 198 | if [ -f $stri ] ; then |
---|
| 199 | echo $str1 \\ |
---|
| 200 | str1='$(LIBF)/'$diri'/'$stri |
---|
| 201 | else |
---|
| 202 | if [ -f $stri.F ] || [ -f $stri.F90 ] ; then |
---|
| 203 | echo $str1 \\ |
---|
| 204 | str1='$(LIBO)/lib'$diri'.a('$stri'.o)' |
---|
| 205 | else |
---|
[1112] | 206 | for dirinc in dyn3d grid bibio filtrez |
---|
[524] | 207 | do |
---|
| 208 | if [ -f ../$dirinc/$stri ] ; then |
---|
| 209 | echo $str1 \\ |
---|
| 210 | str1='$(LIBF)/'`cd .. ; ls */$stri | head -1` |
---|
| 211 | fi |
---|
[1112] | 212 | if [ -f ../$dirinc/$stri.F90 ] ; then |
---|
| 213 | echo $str1 \\ |
---|
| 214 | str1='$(LIBO)/lib'$dirinc'.a('$stri'.o)' |
---|
| 215 | fi |
---|
[524] | 216 | done |
---|
| 217 | fi |
---|
| 218 | fi |
---|
| 219 | done |
---|
| 220 | echo $str1 |
---|
[768] | 221 | if [ "$F90" -eq '0' ] ; then |
---|
[524] | 222 | echo ' cd $(LOCAL_DIR); \' |
---|
| 223 | echo ' $(COMPILE) $(LIBF)/'$diri'/'$trufile' ; \' |
---|
| 224 | else |
---|
| 225 | echo ' cd $(LOCAL_DIR); \' |
---|
| 226 | if [ -f $fili.F90 ] ; then |
---|
| 227 | echo ' $(COMPTRU90) $(LIBF)/'$diri'/'$trufile' ; \' |
---|
| 228 | else |
---|
| 229 | echo ' $(COMPILE90) $(LIBF)/'$diri'/'$trufile' ; \' |
---|
| 230 | fi |
---|
| 231 | MODU=0; egrep -i '^ *module ' $trufile> /dev/null 2>&1 && MODU=1 |
---|
| 232 | if [ "$MODU" -eq '1' -a "$CRAY" != '1' ] ; then |
---|
| 233 | if [ "$os" = 'UNIX_System_V' ] ; then |
---|
| 234 | echo ' cp $(MOD_LOC_DIR)/*.$(MOD_SUFFIX) $(LIBO)/ ; \' |
---|
| 235 | else |
---|
[881] | 236 | echo ' mv $(MOD_LOC_DIR)/'$fili'.$(MOD_SUFFIX) $(LIBO)/'$fili'.$(MOD_SUFFIX) ; \' |
---|
| 237 | # echo ' if [ "$(MOD_LOC_DIR)" ne "$(LIBO)" ] ; then mv $(MOD_LOC_DIR)/'*'.$(MOD_SUFFIX) $(LIBO) ; fi ; \' |
---|
[524] | 238 | fi |
---|
| 239 | fi |
---|
| 240 | fi |
---|
[768] | 241 | if ( [ "$XNEC" -eq '1' ] || [ "$X6NEC" = '1' ] || [ "$X8BRODIE" = '1' ] ) ; then |
---|
[524] | 242 | echo ' sxar r $(LIBO)/libsx'$diri'.a '$fili'.o ; \' |
---|
| 243 | fi |
---|
| 244 | echo ' $(AR) r $(LIBO)/lib'$diri'.a '$fili'.o ; $(RM) '$fili'.o ; \' |
---|
| 245 | echo ' cd $(GCM)' |
---|
| 246 | echo |
---|
| 247 | done |
---|
| 248 | # |
---|
| 249 | echo |
---|
| 250 | cd $libf |
---|
| 251 | fi |
---|
| 252 | fi |
---|
| 253 | done |
---|