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