/[MITgcm]/MITgcm/tools/genmake2
ViewVC logotype

Diff of /MITgcm/tools/genmake2

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.252 by jmc, Mon Jul 22 19:11:31 2013 UTC revision 1.253 by jmc, Wed Jul 24 00:33:53 2013 UTC
# Line 607  EOF Line 607  EOF
607  mpi_headers_do_local_copy() {  mpi_headers_do_local_copy() {
608    
609      dBug=0      dBug=0
610      #----- check for additional headers (chain of included headers)      rm -rf ./mpi_headers
611      listIni=$MPI_HEADER_FILES      if test -d $MPIINCLUDEDIR ; then
612      echo $listIni | grep "\<mpif.h\>" > /dev/null 2>&1  
613      outp=$?          #----- check for additional headers (chain of included headers)
614      #- always check mpif.h (the only mpi-header included in standard MITgcm code)          echo -n '  Check MPI headers ... '
615      if test $outp != 0 ; then listIni="mpif.h $listIni" ; fi          listIni=$MPI_HEADER_FILES
616      if test $dBug = 1 ; then echo "listIni='$listIni'" ; fi          echo $listIni | grep "\<mpif.h\>" > /dev/null 2>&1
617      doCheck=1 ; list2copy='' ; list2check=$listIni          outp=$?
618      while test $doCheck = 1 ; do          #- always check mpif.h (the only mpi-header included in standard MITgcm code)
619          newList=''          if test $outp != 0 ; then listIni="mpif.h $listIni" ; fi
620          for i in $list2check ; do          if test $dBug = 1 ; then echo "listIni='$listIni'" ; fi
621           if test -f $MPIINCLUDEDIR/$i ; then  
622              newInc=`grep '^ *include ' $MPIINCLUDEDIR/$i | \          doCheck=1 ; list2copy='' ; list2check=$listIni
623            while test $doCheck = 1 ; do
624              newList=''
625              for i in $list2check ; do
626                if test -f $MPIINCLUDEDIR/$i ; then
627                  newInc=`grep '^ *include ' $MPIINCLUDEDIR/$i | \
628                  sed -e 's/^ *include //' -e 's/\!.*$//' -e "s/'//g"  -e 's/\"//g'`                  sed -e 's/^ *include //' -e 's/\!.*$//' -e "s/'//g"  -e 's/\"//g'`
629             if test $dBug = 1 ; then echo -n "checking $i : newInc='$newInc'" ; fi                if test $dBug = 1 ; then echo -n "checking $i : newInc='$newInc'" ; fi
630             for j in $newInc ; do                for j in $newInc ; do
631               echo $listIni $list2copy $newList | grep "\<$j\>" > /dev/null 2>&1                  echo $listIni $list2copy $newList | grep "\<$j\>" > /dev/null 2>&1
632               outp=$?                  outp=$?
633               if test $outp != 0 ; then                  if test $outp != 0 ; then
634                  if test $dBug = 1 ; then echo -n " ; adding $j" ; fi                    if test $dBug = 1 ; then echo -n " ; adding $j" ; fi
635                  newList="$newList $j"                    newList="$newList $j"
636               fi                  fi
637             done                done
638             if test $dBug = 1 ; then echo "" ; fi                if test $dBug = 1 ; then echo "" ; fi
639           fi              fi
640              done
641              if test "x$newList" = x ; then doCheck=0
642              else list2check=$newList ; list2copy="$list2copy $newList"
643              fi
644          done          done
645          if test "x$newList" = x ; then doCheck=0          list2copy="$MPI_HEADER_FILES $list2copy"
646          else list2check=$newList ; list2copy="$list2copy $newList"          if test $dBug = 1 ; then echo "list2copy='$list2copy'" ; fi
647          fi  
648      done          #----- create local mpi_headers dir if we have files to copy
649      list2copy="$MPI_HEADER_FILES $list2copy"          mkListInc=`echo $list2copy | wc -w`
650      if test $dBug = 1 ; then echo "list2copy='$list2copy'" ; fi          if test $mkListInc != 0 ; then
651      #----- make local copy and update LOCAL_MPI_HEADERS (if not already set)            echo 'create local "./mpi_headers" dir'
652      mkListInc=0            mkdir -p ./mpi_headers
653      for i in $list2copy ; do            INCLUDES="-I./mpi_headers $INCLUDES"
654          if test -f $MPIINCLUDEDIR/$i ; then            mkListInc=1
655            fi
656            if test "x$LOCAL_MPI_HEADERS" != x ; then mkListInc=0 ; fi
657    
658            #----- make local copy and update LOCAL_MPI_HEADERS (if not already set)
659            for i in $list2copy ; do
660              if test -f $MPIINCLUDEDIR/$i ; then
661              cp -p $MPIINCLUDEDIR/$i ./mpi_headers              cp -p $MPIINCLUDEDIR/$i ./mpi_headers
662              if test $i = 'mpif.h' ; then              if test $i = 'mpif.h' ; then
663                  perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h                  perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h
664              fi              fi
665              if test $mkListInc = 1 ; then              if test $mkListInc = 2 ; then
666                  LOCAL_MPI_HEADERS="$LOCAL_MPI_HEADERS ./mpi_headers/$i"                  LOCAL_MPI_HEADERS="$LOCAL_MPI_HEADERS ./mpi_headers/$i"
667              fi              fi
668              if test "x$LOCAL_MPI_HEADERS" = x ; then              if test $mkListInc = 1 ; then
669                  LOCAL_MPI_HEADERS="./mpi_headers/$i" ; mkListInc=1                  LOCAL_MPI_HEADERS="./mpi_headers/$i" ; mkListInc=2
670              fi              fi
671          fi            fi
672      done          done
673        else
674            echo "WARNING: MPIINCLUDEDIR='$MPIINCLUDEDIR' is not a directory"
675            echo "WARNING: => skip checking for MPI headers (no ./mpi_headers dir)"
676    #       exit -1
677        fi
678  }  }
679    
680  #  Parse the package dependency information  #  Parse the package dependency information
# Line 2559  for i in $INCLUDEDIRS ; do Line 2579  for i in $INCLUDEDIRS ; do
2579  done  done
2580    
2581  if test ! "x$DIVA" = x -a ! "x$MPI" = x ; then  if test ! "x$DIVA" = x -a ! "x$MPI" = x ; then
2582    if test ! "x$MPIINCLUDEDIR" = x ; then      if test ! "x$MPIINCLUDEDIR" = x ; then
     if test -d $MPIINCLUDEDIR ; then  
         echo "  Creating the pseudo-MPI include directory"  
         INCLUDES="-I./mpi_headers $INCLUDES"  
         rm -rf ./mpi_headers  
         mkdir -p ./mpi_headers  
2583          #  Do a local copy of MPI headers files (in local dir ./mpi_headers/) after          #  Do a local copy of MPI headers files (in local dir ./mpi_headers/) after
2584          #   checking for additional included headers (in case of chain of included          #   checking for additional included headers (in case of chain of included
2585          #   header); also set LOCAL_MPI_HEADERS (if not already set)          #   header); also set LOCAL_MPI_HEADERS (if not already set)
2586          mpi_headers_do_local_copy          mpi_headers_do_local_copy
     else  
         echo "WARNING: MPIINCLUDEDIR='$MPIINCLUDEDIR' is not a dir"  
         echo "WARNING: ==> cannot create pseudo-MPI include directory"  
 #       exit -1  
2587      fi      fi
   fi  
2588  fi  fi
2589    
2590  echo "  Determining the list of source and include files"  echo "  Determining the list of source and include files"
# Line 2971  CLEAN: Line 2981  CLEAN:
2981          -rm -f *.txt STDOUT.* STDERR.* *diagnostics.log *.[0-9][0-9][0-9][0-9].log          -rm -f *.txt STDOUT.* STDERR.* *diagnostics.log *.[0-9][0-9][0-9][0-9].log
2982          -rm -f datetime costfinal divided.ctrl snapshot* output_adm.txt.diva_*          -rm -f datetime costfinal divided.ctrl snapshot* output_adm.txt.diva_*
2983          -rm -f *_MIT_CE_000.opt0000 costfunction*0000          -rm -f *_MIT_CE_000.opt0000 costfunction*0000
2984          -rm -f oad_cp.000.[0-9][0-9][0-9][0-9][0-9]          -rm -f oad_cp.[0-9][0-9][0-9].?????
2985    
2986  makefile:  makefile:
2987          $THIS_SCRIPT $G2ARGS          $THIS_SCRIPT $G2ARGS

Legend:
Removed from v.1.252  
changed lines
  Added in v.1.253

  ViewVC Help
Powered by ViewVC 1.1.22