/[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.4 by edhill, Tue Aug 26 16:22:15 2003 UTC revision 1.5 by edhill, Wed Aug 27 22:12:31 2003 UTC
# Line 80  EOF Line 80  EOF
80    
81  }  }
82    
 parse_options()  {  
   
     ac_prev=  
     for ac_option in "${OPTIONS[@]}" ; do  
   
         # echo "ac_option = :$ac_option:"  
           
         # If the previous option needs an argument, assign it.  
         if test -n "$ac_prev"; then  
             eval "$ac_prev=\$ac_option"  
             ac_prev=  
             continue  
         fi  
           
         ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`  
           
         case $ac_option in  
               
             -help | --help | -h | --h)  
                 usage ;;  
               
             -nooptfile | --nooptfile)  
                 OPTFILE="NONE" ;;  
             -optfile | --optfile | -of | --of)  
                 ac_prev=optfile ;;  
             -optfile=* | --optfile=* | -of=* | --of=*)  
                 OPTFILE=$ac_optarg ;;  
               
             -pdepend | --pdepend)  
                 ac_prev=pdepend ;;  
             -pdepend=* | --pdepend=*)  
                 PDEPEND=$ac_optarg ;;  
               
             -pdefault | --pdefault)  
                 ac_prev=pdefault ;;  
             -pdefault=* | --pdefault=*)  
                 PDEFAULT=$ac_optarg ;;  
               
             -makefile | -ma)  
                 ac_prev=makefile ;;  
             --makefile=* | -ma=*)  
                 MAKEFILE=$ac_optarg ;;  
               
             -platform | --platform | -pl | --pl)  
                 ac_prev=platform ;;  
             -platform=* | --platform=* | -pl=* | --pl=*)  
                 PLATFORM=$ac_optarg ;;  
   
             -rootdir | --rootdir | -rd | --rd)  
                 ac_prev=rootdir ;;  
             -rootdir=* | --rootdir=* | -rd=* | --rd=*)  
                 ROOTDIR=$ac_optarg ;;  
               
             -mods | --mods | -mo | --mo)  
                 ac_prev=mods ;;  
             -mods=* | --mods=* | -mo=* | --mo=*)  
                 MODS=$ac_optarg ;;  
               
             -disable | --disable)  
                 ac_prev=disable ;;  
             -disable=* | --disable=*)  
                 DISABLE=$ac_optarg ;;  
               
             -enable | --enable)  
                 ac_prev=enable ;;  
             -enable=* | --enable=*)  
                 ENABLE=$ac_optarg ;;  
               
             -noopt | --noopt)  
                 ac_prev=noopt ;;  
             -noopt=* | --noopt=*)  
                 NOOPT=$ac_optarg ;;  
               
 #           -cpp | --cpp)  
 #               ac_prev=cpp ;;  
 #           -cpp=* | --cpp=*)  
 #               CPP=$ac_optarg ;;  
               
             -fortran | --fortran | -fc | --fc)  
                 ac_prev=fc ;;  
             -fc=* | --fc=*)  
                 FC=$ac_optarg ;;  
               
             -ieee | --ieee)  
                 IEEE=1 ;;  
             -noieee | --noieee)  
                 IEEE=0 ;;  
               
             -mpi | --mpi)  
                 MPI=1 ;;  
             -nompi | --nompi)  
                 MPI=0 ;;  
               
             -jam | --jam)  
                 JAM=1 ;;  
             -nojam | --nojam)  
                 JAM=0 ;;  
               
             -*)  
                 echo "Error: unrecognized option: "$ac_option  
                 usage  
                 ;;  
               
             *)  
                 echo "Error: unrecognized argument: "$ac_option  
                 usage  
                 ;;  
               
         esac  
           
     done  
 }  
   
83  #  Parse the package dependency information  #  Parse the package dependency information
84  get_pdepend_list()  {  get_pdepend_list()  {
85    
# Line 255  usage()  { Line 142  usage()  {
142      exit 1      exit 1
143  }  }
144    
 # Dump all important state  
 dump_state()  {  
     fname=$1  
     echo " " > $fname  
     RETVAL=$?  
     if test "x${RETVAL}" = x ; then  
         echo "Error: cannot write to $fname"  
         exit 1  
     fi  
     echo "makefile "$makefile > $fname  
 }  
   
   
145  #eh3 # This is the generic configuration.  #eh3 # This is the generic configuration.
146  #eh3 set LN         = ( 'ln -s' )  #eh3 set LN         = ( 'ln -s' )
147  #eh3 set CPP        = ( '/lib/cpp -P' )  #eh3 set CPP        = ( '/lib/cpp -P' )
# Line 288  dump_state()  { Line 162  dump_state()  {
162  #eh3 if (! $?NOOPTFLAGS ) set NOOPTFLAGS = (  )  #eh3 if (! $?NOOPTFLAGS ) set NOOPTFLAGS = (  )
163    
164  #  Set defaults here  #  Set defaults here
165    COMMANDL="$0 $@"
166    
167  PLATFORM=  PLATFORM=
168  LN=  LN=
169  S64=  S64=
# Line 300  DISABLE= Line 176  DISABLE=
176  MAKEFILE=  MAKEFILE=
177  MAKEDEPEND=  MAKEDEPEND=
178  PDEPEND=  PDEPEND=
179    DUMPSTATE=f
180  PDEFAULT=  PDEFAULT=
181  OPTFILE=  OPTFILE=
182  INCLUDES="-I."  INCLUDES="-I."
# Line 325  THISCWD=`pwd` Line 202  THISCWD=`pwd`
202  THISDATE=`date`  THISDATE=`date`
203  MACHINE=`uname -a`  MACHINE=`uname -a`
204    
205    #  The following state can be set directly by command-line switches
206    gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT"
207    gm_s2="FC IEEE MPI JAM DUMPSTATE"
208    
209    #  The following state is not directly set by command-line switches
210    gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM "
211    gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"
212    gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE"
213    
214    gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5"
215    
216    
217  echo  echo
218  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
219  gm_local="./gm_local"  gm_local="./gm_local"
# Line 444  for ac_option ; do Line 333  for ac_option ; do
333          -nojam | --nojam)          -nojam | --nojam)
334              JAM=0 ;;              JAM=0 ;;
335                    
336            -ds | --ds)
337                DUMPSTATE=t ;;
338            
339          -*)          -*)
340              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
341              usage              usage
# Line 476  else Line 368  else
368                  echo "--please check that variable syntax is bash-compatible"                  echo "--please check that variable syntax is bash-compatible"
369                  exit 1                  exit 1
370              fi              fi
371                if test "x$DUMPSTATE" != xf ; then
372                    cp -f $OPTFILE "gm_optfile"
373                fi
374          else          else
375              echo "Error: can't read OPTFILE=\"$OPTFILE\""              echo "Error: can't read OPTFILE=\"$OPTFILE\""
376              exit 1              exit 1
# Line 1120  echo "  Adding makedepend marker" Line 1015  echo "  Adding makedepend marker"
1015  printf "\n\n# DO NOT DELETE\n" >> $MAKEFILE  printf "\n\n# DO NOT DELETE\n" >> $MAKEFILE
1016    
1017  printf "\n===  Done  ===\n"  printf "\n===  Done  ===\n"
1018    
1019    
1020    #  Write the "state" for future records
1021    if test "x$DUMPSTATE" != xf ; then
1022        echo -n "" > gm_state
1023        for i in $gm_state ; do
1024            t1="t2=\$$i"
1025            eval $t1
1026            echo "$i='$t2'" >> gm_state
1027        done
1028    fi

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.22