Annotation of researchv10no/cmd/f2c/fc, revision 1.1.1.1

1.1       root        1: #!/bin/sh
                      2: PATH=/v/bin:/bin:/usr/bin
                      3: # f77-style shell script to compile and load fortran, C, and assembly codes
                      4: 
                      5: #      usage:  f77 [-g] [-O] [-o absfile] [-c] files [-l library]
                      6: 
                      7: #              -o objfile      Override default executable name a.out.
                      8: 
                      9: #              -c              Do not call linker, leave relocatables in *.o.
                     10: 
                     11: #              -S              leave assembler output on file.s
                     12: 
                     13: #              -l library      (passed to ld).
                     14: 
                     15: #              -u              complain about undeclared variables
                     16: 
                     17: #              -w              omit all warning messages
                     18: 
                     19: #              -w66            omit Fortran 66 compatibility warning messages
                     20: 
                     21: #              files           FORTRAN source files ending in .f .
                     22: #                              C source files ending in .c .
                     23: #                              Assembly language files ending in .s .
                     24: #                              efl source files ending in .e .
                     25: 
                     26: #              -D def          passed to C compiler (for .c files)
                     27: 
                     28: #              -I includepath  passed to C compiler (for .c files)
                     29: 
                     30: #              -Ntnnn          allow nnn entries in table t
                     31: 
                     32: s=/tmp/stderr_$$
                     33: t=/tmp/f77_$$.o
                     34: CC=${CC_f2c:-'/v/bin/lcc -Wfdouble=8,4,1'}
                     35: EFL=${EFL:-/v/bin/efl}
                     36: EFLFLAGS=${EFLFLAGS:-'system=portable deltastno=10'}
                     37: F2C=${F2C:-/v/bin/f2c}
                     38: F2CFLAGS=${F2CFLAGS:='-ARw8 -Nn802'}
                     39: rc=0
                     40: trap "rm -f $s $t; exit \$rc" 0
                     41: lib=/lib/num/lib.lo
                     42: OUTF=a.out
                     43: cOPT=1
                     44: set -- `getopt cD:gI:N:O:o:Suw6 "$@"`
                     45: case $? in 0);; *) exit 1;; esac
                     46: CCFLAGS=
                     47: while
                     48:        test X"$1" != X--
                     49: do
                     50:        case "$1"
                     51:        in
                     52:        -c)     cOPT=0
                     53:                shift
                     54:                ;;
                     55: 
                     56:        -D)     CCFLAGS="$CCFLAGS -D$2"
                     57:                shift 2
                     58:                ;;
                     59: 
                     60:        -g)     CFLAGS="$CFLAGS -g"
                     61:                CCFLAGS="$CCFLAGS -g"
                     62:                F2CFLAGS="$F2CFLAGS -g"
                     63:                shift;;
                     64: 
                     65:        -I)     CCFLAGS="$CCFLAGS -I$2"
                     66:                shift 2
                     67:                ;;
                     68: 
                     69:        -o)     OUTF=$2
                     70:                shift 2
                     71:                ;;
                     72: 
                     73:        -O)     case $2 in -1) O=-O1;; -2) O=-O2;; -3) O=-O3;; *) O=-O;; esac
                     74:                case $O in -O);; *) shift;; esac
                     75:                # lcc ignores -O...
                     76:                shift
                     77:                ;;
                     78: 
                     79:        -u)     F2CFLAGS="$F2CFLAGS -u"
                     80:                shift
                     81:                ;;
                     82: 
                     83:        -w)     F2CFLAGS="$F2CFLAGS -w"
                     84:                case $2 in -6) F2CFLAGS="$F2CFLAGS"66; shift
                     85:                        case $2 in -6) shift;; esac;; esac
                     86:                shift
                     87:                ;;
                     88: 
                     89:        -N)     F2CFLAGS="$F2CFLAGS $1""$2"
                     90:                shift 2
                     91:                ;;
                     92: 
                     93:        -S)     CFLAGS="$CFLAGS -S"
                     94:                cOPT=0
                     95:                shift
                     96:                ;;
                     97: 
                     98:        *)
                     99:                echo "invalid parameter $1" 1>&2
                    100:                shift
                    101:                ;;
                    102:        esac
                    103: done
                    104: shift
                    105: while
                    106:        test -n "$1"
                    107: do
                    108:        case "$1"
                    109:        in
                    110:        *.[fF])
                    111:                case "$1" in *.f) f=".f";; *.F) f=".F";; esac
                    112:                b=`basename $1 $f`
                    113:                $F2C $F2CFLAGS $1
                    114:                case $? in 0);; *) exit;; esac
                    115:                 $CC -c $CFLAGS $b.c 2>$s
                    116:                rc=$?
                    117:                sed '/parameter .* is not referenced/d;/warning: too many parameters/d' $s 1>&2
                    118:                case $rc in 0);; *) exit;; esac
                    119:                OFILES="$OFILES $b.o"
                    120:                rm $b.c
                    121:                case $cOPT in 1) cOPT=2;; esac
                    122:                shift
                    123:                ;;
                    124:        *.e)
                    125:                b=`basename $1 .e`
                    126:                $EFL $EFLFLAGS $1 >$b.f
                    127:                case $? in 0);; *) exit;; esac
                    128:                $F2C $F2CFLAGS $b.f
                    129:                case $? in 0);; *) exit;; esac
                    130:                 $CC -c $CFLAGS $b.c
                    131:                case $? in 0);; *) exit;; esac
                    132:                OFILES="$OFILES $b.o"
                    133:                rm $b.[cf]
                    134:                case $cOPT in 1) cOPT=2;; esac
                    135:                shift
                    136:                ;;
                    137:        *.s)
                    138:                echo $1: 1>&2
                    139:                OFILE=`basename $1 .s`.o
                    140:                ${AS:-/usr/bin/as} -o $OFILE $AFLAGS $1
                    141:                case $? in 0);; *) exit;; esac
                    142:                OFILES="$OFILES $OFILE"
                    143:                case $cOPT in 1) cOPT=2;; esac
                    144:                shift
                    145:                ;;
                    146:        *.c)
                    147:                echo $1: 1>&2
                    148:                OFILE=`basename $1 .c`.o
                    149:                 $CC -c $CFLAGS $CCFLAGS $1
                    150:                rc=$?; case $rc in 0);; *) exit;; esac
                    151:                OFILES="$OFILES $OFILE"
                    152:                case $cOPT in 1) cOPT=2;; esac
                    153:                shift
                    154:                ;;
                    155:        *.o)
                    156:                OFILES="$OFILES $1"
                    157:                case $cOPT in 1) cOPT=2;; esac
                    158:                shift
                    159:                ;;
                    160:        -l)
                    161:                OFILES="$OFILES -l$2"
                    162:                shift 2
                    163:                case $cOPT in 1) cOPT=2;; esac
                    164:                ;;
                    165:        -l*)
                    166:                OFILES="$OFILES $1"
                    167:                shift
                    168:                case $cOPT in 1) cOPT=2;; esac
                    169:                ;;
                    170:        -o)
                    171:                OUTF=$2; shift 2;;
                    172:        *)
                    173:                OFILES="$OFILES $1"
                    174:                shift
                    175:                case $cOPT in 1) cOPT=2;; esac
                    176:                ;;
                    177:        esac
                    178: done
                    179: 
                    180: case $cOPT in 2) $CC -o $OUTF -u MAIN__ $OFILES -lf2c -lm;; esac
                    181: rc=$?
                    182: exit $rc

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.