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