| 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 | 
| 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 | 
| 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 | 
| 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 | *) ;; | *) ;; | 
| 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 | 
| 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 |