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