/[MITgcm]/MITgcm_contrib/jmc_script/mk_mkfile
ViewVC logotype

Diff of /MITgcm_contrib/jmc_script/mk_mkfile

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

revision 1.1 by jmc, Mon Apr 27 21:36:54 2009 UTC revision 1.2 by jmc, Mon Jan 23 23:40:01 2012 UTC
# Line 1  Line 1 
1  #! /usr/bin/env bash  #! /usr/bin/env bash
2    
3    # $Header$
4    # $Name$
5    
6  mkfile='Makefile'  mkfile='Makefile'
7  if [ $# -ge 1 ] ; then  if [ $# -ge 1 ] ; then
8    if test $1 = '-h' ; then    if test $1 = '-h' ; then
9      echo "Usage: `basename $0` MAKEFILE (default: 'Makefile') ; [-h] print this"      echo "Usage: `basename $0` MAKEFILE (default: 'Makefile') ; [-h] print this"
10      exit 9      exit 9
11    fi    fi
12    mkfile=$1    mkfile=$1
13  fi  fi
14      
15  if test ! -f $mkfile ; then  if test ! -f $mkfile ; then
16    echo "`basename $0` error: missing file '$mkfile'"    echo "`basename $0` error: missing file '$mkfile'"
17    exit 8    exit 8
# Line 39  do Line 42  do
42        continue        continue
43    fi    fi
44    if [ $n1 -eq 0 -a $dbq -eq 1 ] ; then    if [ $n1 -eq 0 -a $dbq -eq 1 ] ; then
45      if [ $n2 -eq 1 ] ; then      if [ $n2 -eq 1 ] ; then
46        n1=$dbq ; dbq=0        n1=$dbq ; dbq=0
47        xx="$keep $xx"        xx="$keep $xx"
48      else      else
49        keep="$keep $xx"        keep="$keep $xx"
50        continue        continue
51      fi      fi
# Line 59  do Line 62  do
62        continue        continue
63    fi    fi
64    if [ $n1 -eq 0 -a $sgq -eq 1 ] ; then    if [ $n1 -eq 0 -a $sgq -eq 1 ] ; then
65      if [ $n2 -eq 1 ] ; then      if [ $n2 -eq 1 ] ; then
66        n1=$sgq ; sgq=0        n1=$sgq ; sgq=0
67        xx="$keep $xx"        xx="$keep $xx"
68      else      else
69        keep="$keep $xx"        keep="$keep $xx"
70        continue        continue
71      fi      fi
# Line 98  do Line 101  do
101        continue        continue
102    fi    fi
103    case $arg in    case $arg in
104     -mpi | --mpi | -mpi=* | --mpi=* )     -mpi | --mpi | -mpi=* | --mpi=* )
105        MPI=`expr $MPI + 1` ;;        MPI=`expr $MPI + 1` ;;
106     -mods | --mods | -mo | --mo )     -mods | --mods | -mo | --mo )
107        prev=MODS        prev=MODS
108        flg=`expr $flg + 1` ;;        flg=`expr $flg + 1` ;;
109     -mods=* | --mods=* | -mo=* | --mo=* )     -mods=* | --mods=* | -mo=* | --mo=* )
110        MODS=$opt        MODS=$opt
111        flg=`expr $flg + 1` ;;        flg=`expr $flg + 1` ;;
112      *) ;;      *) ;;
# Line 159  for d in $MODS ; do Line 162  for d in $MODS ; do
162              fi              fi
163            else            else
164            # YES: We symbolically link this file (with conditions if already there)            # YES: We symbolically link this file (with conditions if already there)
165                src="$d/$ii"
166                if test $name = "SIZE.h" -a -f SIZE.h.mpi ; then src="SIZE.h.mpi" ; fi
167              if test -L $name ; then              if test -L $name ; then
168                cmp $d/$ii $name > /dev/null 2>&1                cmp $src $name > /dev/null 2>&1
169                RETVAL=$?                RETVAL=$?
170                yy=0 ;                yy=0 ;
171                for xx in $MPI_LNKF ; do if test $xx = $name ; then yy=1 ; fi ; done                for xx in $MPI_LNKF ; do if test $xx = $name ; then yy=1 ; fi ; done
172                if test "x$RETVAL" != x0 -a $yy = 0 ; then                if test "x$RETVAL" != x0 -a $yy = 0 ; then
173                # remove sym-link if different and has not just been linked                # remove sym-link if different and has not just been linked
# Line 176  for d in $MODS ; do Line 181  for d in $MODS ; do
181              fi              fi
182              if ! test -f $name ; then              if ! test -f $name ; then
183                # make sym-link and keep record of it                # make sym-link and keep record of it
184                  printf "Linking $ii to $name ; "                  printf "Linking $src to $name ; "
185                  ln -sf $d/$ii $name                  ln -sf $src $name
186                  MPI_LNKF="$MPI_LNKF $name"                  MPI_LNKF="$MPI_LNKF $name"
187              fi              fi
188            fi            fi

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22