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