[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 |
---|
[168] | 12 | XNEC=0 |
---|
| 13 | if [ "$machine" = "rhodes" ] ; then |
---|
| 14 | XNEC=1 |
---|
| 15 | fi |
---|
| 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 |
---|
[168] | 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' |
---|
[168] | 79 | echo 'COMPTRU90 = $(F90) $(OPTIMTRU90) $(INCLUDE) -c' |
---|
| 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); \' |
---|
[307] | 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 |
---|
[168] | 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 |
---|
[168] | 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 |
---|
[168] | 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 |
---|
[168] | 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 |
---|
[168] | 181 | if [ -f $stri.F ] || [ -f $stri.F90 ] ; then |
---|
[2] | 182 | str1='$(LIBO)/lib'$diri'.a('$stri'.o)' |
---|
| 183 | else |
---|
| 184 | for dirinc in dyn3d grid bibio |
---|
| 185 | do |
---|
| 186 | if [ -f ../$dirinc/$stri ] ; then |
---|
| 187 | echo $str1 \\ |
---|
| 188 | str1='$(LIBF)/'`cd .. ; ls */$stri | head -1` |
---|
| 189 | fi |
---|
| 190 | done |
---|
| 191 | fi |
---|
| 192 | fi |
---|
| 193 | done |
---|
| 194 | echo $str1 |
---|
| 195 | if [ "$F90" -eq '0' ] ; then |
---|
[168] | 196 | echo ' cd $(LOCAL_DIR); \' |
---|
| 197 | echo ' $(COMPILE) $(LIBF)/'$diri'/'$trufile' ; \' |
---|
[2] | 198 | else |
---|
[168] | 199 | echo ' cd $(LOCAL_DIR); \' |
---|
| 200 | if [ -f $fili.F90 ] ; then |
---|
| 201 | echo ' $(COMPTRU90) $(LIBF)/'$diri'/'$trufile' ; \' |
---|
| 202 | else |
---|
| 203 | echo ' $(COMPILE90) $(LIBF)/'$diri'/'$trufile' ; \' |
---|
| 204 | fi |
---|
| 205 | MODU=0; egrep -i ' *module ' $trufile> /dev/null 2>&1 && MODU=1 |
---|
[2] | 206 | if [ "$MODU" -eq '1' -a "$CRAY" != '1' ] ; then |
---|
[172] | 207 | if [ "$os" = 'UNIX_System_V' ] ; then |
---|
[2] | 208 | echo ' cp $(MOD_LOC_DIR)/*.$(MOD_SUFFIX) $(LIBO)/ ; \' |
---|
| 209 | else |
---|
| 210 | echo ' mv $(MOD_LOC_DIR)/'$fili'.$(MOD_SUFFIX) $(LIBO)/'$fili'.$(MOD_SUFFIX) ; \' |
---|
| 211 | fi |
---|
| 212 | fi |
---|
| 213 | fi |
---|
[168] | 214 | if [ "$XNEC" -eq '1' ] ; then |
---|
| 215 | echo ' sxar r $(LIBO)/libsx'$diri'.a '$fili'.o ; \' |
---|
| 216 | fi |
---|
[2] | 217 | echo ' $(AR) r $(LIBO)/lib'$diri'.a '$fili'.o ; $(RM) '$fili'.o ; \' |
---|
| 218 | echo ' cd $(GCM)' |
---|
| 219 | echo |
---|
| 220 | done |
---|
| 221 | # |
---|
| 222 | echo |
---|
| 223 | cd $libf |
---|
| 224 | fi |
---|
| 225 | fi |
---|
| 226 | done |
---|