#!/bin/ksh ## FCE Fortran Compilation into Executable module 2003/12/30 if [[ $# -eq 0 ]] then echo ' Usage: FCE file [xxx.o ...] ' \ ' Fortran Compilation into Executable module' # echo ' FCE uses REAL*8 precision library: libGCM.a ' \ # ' 2003/12/30' exit ; fi ## Check that files pointed to by the arguments exist for ARG ; do if [[ ! -f $ARG ]] then echo "File does not exist: $ARG" ; exit 1 ; fi ; done ARG1=$1 ; shift # $* now points to arguments 2, 3, ... ( FPRG=${ARG1%%.*} # FPRG is beginning of argument 1 up to first . FERR=$FPRG.ERR ; FFOR=$FPRG.f ; FSAV=$ARG1.COP if [[ $FFOR = $ARG1 ]] then cp -p $ARG1 $FSAV ; fi FTOC $ARG1 $FFOR # Options="-O -I$OMDIR" ## IBM Risc 6000 # Options="-O3 -I$OMDIR" ## Sun # Options="-O3 -I$OMDIR -lU77" ## Mac Pro Fortran # Options="-O2 -I$OMDIR -qfixed" ## Mac G5 xlf # Options="-O4 -I$OMDIR -convert big_endian" ## Compaq Alpha Options="-O3 -I$OMDIR -64 -mips4 -OPT:IEEE_arithmetic=3" ## SGI # xlf $Options $FFOR $* 2> $FERR ## IBM Risc # xlf90 $Options $FFOR $* 2> $FERR ## Mac G5 xlf f90 $Options $FFOR $* 2> $FERR ## All others # f90 $Options $FFOR $* $OMDIR/libGCM.a 2> $FERR if [[ $? -eq 0 ]] then echo "Executable module: $FPRG Created from: $ARG1" mv a.out $FPRG ; rm -f $FERR else echo "Fortran error file: $FERR Source file: $ARG1" ; fi rm -f $FFOR if [[ $FFOR = $ARG1 ]] then mv $FSAV $ARG1 ; fi ) &