Changeset 1714


Ignore:
Timestamp:
Jan 18, 2013, 7:10:19 PM (11 years ago)
Author:
Laurent Fairhead
Message:

possibilité de ranger la physique en sous-répertoires


routines in physics can be stored in subdirectories of the phylmd directory

Location:
LMDZ5/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/create_make_gcm

    r1703 r1714  
    44#
    55#set -xv
     6
     7rm -f create_make_gcm.log
     8
    69machine=`hostname`
    710os=`uname`
     
    122125echo
    123126cd $libf >/dev/null 2>&1
    124 for diri in ` ls `
    125 do
     127
     128for diri in ` ls ` ; do
     129
    126130   if [ -d $diri ] ; then
    127    if [ "`ls $diri/*.F`" != "" ] || [ "`ls $diri/*.F90`" != "" ]  ; then
    128       cd $diri >/dev/null 2>&1
     131   if [ "`ls $diri/*.F $diri/*/*.F`" != "" ] || [ "`ls $diri/*.F90 $diri/*/*.F90`" != "" ]  ; then
     132#      cd $diri >/dev/null 2>&1
    129133      echo
    130134      listlib=""
    131       for i in `ls *.F`
    132       do
    133          fili=`basename $i .F`
    134          test=` (  head $i | grep '      PROGRAM' ) `
    135          if [ "$test" = "" ] ; then
    136             listlib=$listlib" "$fili
    137          fi
    138       done
    139       for i in `ls *.F90`
    140       do
    141          fili=`basename $i .F90`
    142          test=` (  head $i | grep '      PROGRAM' ) `
    143          if [ "$test" = "" ] ; then
    144             listlib=$listlib" "$fili
    145          fi
    146       done
    147 #
    148       echo
    149       echo
    150       echo "#======================================================================="
     135# Liste des fichiers .F et .F90 n'etant pas des programmes principaux
     136      for fili in `ls $diri/*.F $diri/*/*.F` ; do
     137         test=` (  head $fili | grep '      PROGRAM' ) `
     138         if [ "$test" = "" ] ; then listlib=$listlib" "$fili ; fi
     139      done
     140      for fili in `ls $diri/*.F90 $diri/*/*.F90` ; do
     141         test=` (  head $fili | grep 'PROGRAM' ) `
     142         if [ "$test" = "" ] ; then listlib=$listlib" "$fili ; fi
     143      done
     144      echo
     145      echo $listlib >> create_makeg_gcm.log
     146      echo
     147      echo "#=================================================================="
    151148      echo "# Contenu de la bibliotheque correspondant au Directory "$diri
    152       echo "#======================================================================="
    153       echo
    154       for fili in $listlib
    155       do
     149      echo "#=================================================================="
     150      echo
     151      for trufile in $listlib ; do
     152         fili=`echo $trufile | awk -F/ ' { print $NF } ' | cut -d. -f1`
    156153         echo '$(LIBO)/lib'$diri".a : " '$(LIBO)/lib'$diri".a("$fili".o)"
    157154         echo
     
    162159      echo "# Compilation des membres de la bibliotheque lib"$diri".a"
    163160      echo
    164       for fili in $listlib
    165       do
    166          if [ -f $fili.F90 ] ; then
    167            trufile=$fili.F90
    168          else
    169            trufile=$fili.F
    170          fi
     161      for trufile in $listlib ; do
     162         fili=`echo $trufile | awk -F/ ' { print $NF } ' | cut -d. -f1`
    171163         F90=0 ; egrep -i '^ *use ' $trufile > /dev/null 2>&1 && F90=1
    172164                 egrep -i '^ *module ' $trufile > /dev/null 2>&1 && F90=1
    173165                 egrep -i '#include*.inc ' $trufile > /dev/null 2>&1 && F90=1
    174          str1='$(LIBO)/lib'$diri'.a('$fili'.o) : $(LIBF)/'$diri/$trufile
    175          [ "$fili" = "chem.subs" ] && str1=$str1' $(LIBF)/'$diri/chem.mods.F
    176          for stri in ` ( sed -n "/\#include/s/\#include//p" $trufile | sed 's/\"//g' ; egrep -i '^ *use ' $trufile | sed -e 's/,/ /' | awk ' { print $2 } ' ) `
    177          do
    178 
    179 
     166         str1='$(LIBO)/lib'$diri'.a('$fili'.o) : $(LIBF)/'$trufile
     167         [ "$fili" = "$diri/chem.subs" ] && str1=$str1' $(LIBF)/'$diri/chem.mods.F
     168
     169##########################################################################
     170# TRAITEMENT DES DEPENDANCES
    180171# Differents cas de dependance correspondant a des include ou des
    181172# use module.
    182173# soit dans le repertoire local soit dans un autre.
    183 
    184             stri=`echo $stri | tr [A-Z] [a-z]`
    185             if [ -f $stri ] ; then
     174# Pour dyn3d, il faudrait remplacer la chaine de caractere par $DYN
     175# ou quelque chose du genre.
     176##########################################################################
     177
     178         for stri in ` ( sed -e '/^[cC\!]/d' $trufile | sed -n "/\#include/s/\#include//p" | sed 's/\"//g' ; sed -e '/^[cC\!]/d' $trufile | egrep -i '^ *use ' | sed -e 's/,/ /' | awk ' { print $2 } ' ) ` ; do
     179            echo $trufile $fili $stri >> create_make_gcm.log
     180            strj=`echo $stri | tr [A-Z] [a-z]`
     181            str2=""
     182            for dirinc in filtrez bibio grid dyn3d $diri $diri/*/ ; do
     183# Recherche dans l'ordre hierarchique inverse car seule la derniere
     184# ligne est conservee
     185               if [ -f $dirinc/$stri ] ; then
     186                  str2='$(LIBF)/'$dirinc/$stri
     187               elif [ -f $dirinc/$strj ] ; then
     188                  str2='$(LIBF)/'$dirinc/$stri
     189               elif [ -f $dirinc/$strj.F90 ]  || [ -f $dirinc/$strj.F ]  ; then
     190                  strlib=`echo $dirinc | awk -F/ ' { print $1 } '`
     191                  str2='$(LIBO)/lib'$strlib'.a('$strj'.o)'
     192               fi
     193            done
     194            if [ "$str2" = "" ] ; then
     195               echo Warn: Include $diri $trufile $fili $stri pas trouve >> $gcm/create_make_gcm.log
     196            elif [ "$str2" = "$str1" ] ; then
     197               echo Warn: Include $diri $trufile $fili $stri $str1 trouve 2x >> $gcm/create_make_gcm.log
     198            else
    186199               echo $str1 \\
    187                str1='$(LIBF)/'$diri'/'$stri
    188             else
    189                if [ -f $stri.F ] || [ -f $stri.F90 ] ; then
    190                   echo $str1 \\
    191                   str1='$(LIBO)/lib'$diri'.a('$stri'.o)'
    192                else
    193                   for dirinc in dyn3d grid bibio filtrez
    194                   do
    195                      if [ -f ../$dirinc/$stri ] ; then
    196                         echo $str1 \\
    197                         str1='$(LIBF)/'`cd .. ; ls */$stri | head -1`
    198                      fi
    199                      if [ -f ../$dirinc/$stri.F90 ] ; then
    200                         echo $str1 \\
    201                         str1='$(LIBO)/lib'$dirinc'.a('$stri'.o)'
    202                      fi
    203                   done
    204                fi
     200               str1=$str2
    205201            fi
    206          done
     202         done # Fin de la boucle sur les dependances et ecriture de la derniere
    207203         echo $str1
    208204         # Compile in LIBO directory; and before compiling, remove
     
    212208         if [ "$F90" -eq '0' ] ; then
    213209         ## Fixed Form Fortran 77
    214            echo '       $(COMPILE) $(LIBF)/'$diri'/'$trufile' ; \'
     210           echo '       $(COMPILE) $(LIBF)/'$trufile' ; \'
    215211         else
    216212         ## Fortran 90
    217            if [ -f $fili.F90 ] ; then
     213           if [ `echo $trufile | cut -d. -f2` = F90 ] ; then
    218214              ## Free Form
    219               echo '    $(COMPTRU90) $(LIBF)/'$diri'/'$trufile' ; \'
     215              echo '    $(COMPTRU90) $(LIBF)/'$trufile' ; \'
    220216           else
    221               echo '    $(COMPILE90) $(LIBF)/'$diri'/'$trufile' ; \'
     217              echo '    $(COMPILE90) $(LIBF)/'$trufile' ; \'
    222218           fi
    223219         fi
  • LMDZ5/trunk/tools/install_1d_src.sh

    • Property svn:executable set to *
Note: See TracChangeset for help on using the changeset viewer.