Annotation of researchv10no/cmd/sml/src/makeml, revision 1.1

1.1     ! root        1: #!/bin/sh
        !             2: #
        !             3: #set -x
        !             4: 
        !             5: IMAGE=""
        !             6: MACHINE=""
        !             7: OPSYS="BSD"
        !             8: MODULEKIND="Int"
        !             9: TARGET=""
        !            10: SHARE="TRUE"
        !            11: DEFS=""
        !            12: CLEAN="TRUE"
        !            13: MKRUN="TRUE"
        !            14: RUNTIME="runtime"
        !            15: NOBOOT=""
        !            16: ASMBLR="as"
        !            17: COMMAND=""
        !            18: IONLY=""
        !            19: CFL=""
        !            20: 
        !            21: #
        !            22: # gc params
        !            23: HEAP=2048
        !            24: RATIO=20
        !            25: SOFTLIMIT=4096
        !            26: 
        !            27: #
        !            28: # try to guess the machine type
        !            29: #
        !            30: if [ -f /bin/arch ]; then
        !            31:     case `/bin/arch` in
        !            32:        sun3)
        !            33:            set - -sun3 $*
        !            34:        ;;
        !            35:        sun4)
        !            36:            set - -sun4 $*
        !            37:        ;;
        !            38:     esac
        !            39: fi
        !            40: 
        !            41: #
        !            42: # process options
        !            43: #
        !            44: while test "$#" != "0"
        !            45: do
        !            46:     case $1 in
        !            47:        -m68|-sun3)
        !            48:            MACHINE=M68
        !            49:        ;;
        !            50:        -sparc|-sun4)
        !            51:            MACHINE=SPARC
        !            52:        ;;
        !            53:        -next)
        !            54:            MACHINE=M68
        !            55:            OPSYS=NEXT
        !            56:        ;;
        !            57:        -encore)
        !            58:            MACHINE=NS32
        !            59:            OPSYS=BSD
        !            60:            ASMBLR="as -j"
        !            61:        ;;
        !            62:        -vax)
        !            63:            MACHINE=VAX
        !            64:        ;;
        !            65:        -bsd)
        !            66:            OPSYS=BSD
        !            67:        ;;
        !            68:        -mach)
        !            69:            OPSYS=MACH
        !            70:        ;;
        !            71:        -sunos)
        !            72:            OPSYS=SUNOS
        !            73:        ;;
        !            74:        -v9)
        !            75:            OPSYS=V9
        !            76:        ;;
        !            77:        -ultrix)
        !            78:            OPSYS=ULTRIX
        !            79:        ;;
        !            80:        -batch)
        !            81:            MODULEKIND=Comp
        !            82:        ;;
        !            83:        -noshare)
        !            84:            SHARE=""
        !            85:        ;;
        !            86:        -run)
        !            87:            MKRUN="TRUE"
        !            88:            NOBOOT="TRUE"
        !            89:        ;;
        !            90:        -norun)
        !            91:            MKRUN=""
        !            92:            CLEAN=""
        !            93:        ;;
        !            94:        -noclean)
        !            95:            CLEAN=""
        !            96:        ;;
        !            97:        -target)
        !            98:            shift
        !            99:            if test "$#" = "0"
        !           100:            then
        !           101:                echo "makeml: must supply machine for -target option"
        !           102:                exit 1
        !           103:            fi
        !           104:            TARGET=$1
        !           105:            MODULEKIND=Comp
        !           106:        ;;
        !           107:        -i)
        !           108:            COMMAND="System.Control.interp := true;"
        !           109:            ;;
        !           110:        -ionly)
        !           111:            COMMAND="System.Control.interp := true;"
        !           112:            IONLY="TRUE"
        !           113:        ;;
        !           114:        -o)
        !           115:            shift
        !           116:            if test "$#" = "0"
        !           117:            then
        !           118:                echo "makeml: must supply image name for -o option"
        !           119:                exit 1
        !           120:            fi
        !           121:            IMAGE=$1
        !           122:        ;;
        !           123:        -runtime)
        !           124:            shift
        !           125:            if test "$#" = "0"
        !           126:            then
        !           127:                echo "makeml: must supply runtime directory for -runtime option"
        !           128:                exit 1
        !           129:            fi
        !           130:            RUNTIME=$1
        !           131:        ;;
        !           132:        -mo)
        !           133:            shift
        !           134:            if test "$#" = "0"
        !           135:            then
        !           136:                echo "makeml: must supply mo directory for -mo option"
        !           137:                exit 1
        !           138:            elif test ! \( -d "$1" \)
        !           139:            then
        !           140:                echo "makeml: mo directory $1 not found"
        !           141:                exit 1
        !           142:            fi
        !           143:            MO=$1
        !           144:        ;;
        !           145:        -h)
        !           146:            shift
        !           147:            if test "$#" = "0"
        !           148:            then
        !           149:                echo "makeml: must supply argument for -h option"
        !           150:                exit 1
        !           151:            fi
        !           152:            HEAP=$1
        !           153:        ;;
        !           154:        -r)
        !           155:            shift
        !           156:            if test "$#" = "0"
        !           157:            then
        !           158:                echo "makeml: must supply argument for -r option"
        !           159:                exit 1
        !           160:            fi
        !           161:            RATIO=$1
        !           162:        ;;
        !           163:        -m)
        !           164:            shift
        !           165:            if test "$#" = "0"
        !           166:            then
        !           167:                echo "makeml: must supply argument for -m option"
        !           168:                exit 1
        !           169:            fi
        !           170:            SOFTLIMIT=$1
        !           171:        ;;
        !           172:        -D*)
        !           173:            DEFS="$DEFS $1"
        !           174:        ;;
        !           175:        *)
        !           176:            echo "makeml: unrecognized option $1"
        !           177:            exit 1
        !           178:        ;;
        !           179:     esac
        !           180:     shift
        !           181: done
        !           182: 
        !           183: if test -z "$IMAGE"
        !           184: then
        !           185:     if test "$MODULEKIND" = Int
        !           186:     then
        !           187:        if test -n "$IONLY"
        !           188:        then
        !           189:            IMAGE=smli
        !           190:        else
        !           191:            IMAGE=sml
        !           192:        fi
        !           193:     else
        !           194:        IMAGE=smlc
        !           195:     fi
        !           196: fi
        !           197: 
        !           198: case $MACHINE in
        !           199:     M68)
        !           200:        case $OPSYS in
        !           201:        MACH)
        !           202:            OPSYS=BSD
        !           203: # drt: added -Dsun3 option to make Mach header files perform correctly
        !           204:            DEFS="$DEFS -Dsun3 -DSUN3"
        !           205:            CFL="-f68881"
        !           206:        ;;
        !           207:        SUNOS)
        !           208:            OPSYS=BSD
        !           209: # awa: for gcc, -f68881 should be changed to -m68881 below.
        !           210:            DEFS="$DEFS -DSUN3"
        !           211:            CFL="-n -Bstatic -f68881"
        !           212:        ;;
        !           213:        NEXT)
        !           214:            DEFS="$DEFS -DBSD"
        !           215:        ;;
        !           216:        *)
        !           217:                echo "For m68 don't use -bsd, use -mach or -next or -sunos"
        !           218:                exit 1
        !           219:        esac
        !           220:        if test -z "$MO"
        !           221:        then
        !           222:            MO="../mo.m68"
        !           223:        fi
        !           224:        MODULE="$MODULEKIND"M68
        !           225:     ;;
        !           226:     SPARC)
        !           227:        case $OPSYS in
        !           228:        MACH)
        !           229:            OPSYS=BSD
        !           230:            DEFS="$DEFS -Dsun4"
        !           231:        ;;
        !           232:        SUNOS)
        !           233:            OPSYS=BSD
        !           234:            DEFS="$DEFS -Dsun4"
        !           235:            CFL="-n -Bstatic"
        !           236:        ;;
        !           237:        *)
        !           238:                echo "For sparc don't use -bsd, use -mach or -sunos"
        !           239:                exit 1
        !           240:        esac
        !           241:        if test -z "$MO"
        !           242:        then
        !           243:            MO="../mo.sparc"
        !           244:        fi
        !           245:        MODULE="$MODULEKIND"Sparc
        !           246:     ;;
        !           247:     VAX)
        !           248:        if test "$OPSYS" = ULTRIX
        !           249:        then
        !           250:            DEFS="$DEFS -DBSD"
        !           251:        fi
        !           252:        if test -z "$MO"
        !           253:        then
        !           254:            MO="../mo.vax"
        !           255:        fi
        !           256:        MODULE="$MODULEKIND"Vax
        !           257:     ;;
        !           258:     NS32)
        !           259:        if test -z "$MO"
        !           260:        then
        !           261:            MO="../mo.ns32"
        !           262:        fi
        !           263:        MODULE="$MODULEKIND"NS32
        !           264:     ;;
        !           265:     *)
        !           266:        echo "makeml: must specify machine type"
        !           267:        exit 1
        !           268:     ;;
        !           269: esac
        !           270: 
        !           271: if test -n "$TARGET"
        !           272: then
        !           273:     case $TARGET in
        !           274:        m68|M68|sun3|next)
        !           275:            TARGET=M68
        !           276:        ;;
        !           277:        sparc|Sparc|SPARC|sun4)
        !           278:            TARGET=Sparc
        !           279:        ;;
        !           280:        vax|Vax|VAX)
        !           281:            TARGET=Vax
        !           282:        ;;
        !           283:        ns32|NS32|encore)
        !           284:            TARGET=NS32
        !           285:        ;;
        !           286:        *)
        !           287:            echo "makeml: invalid argument to -target option"
        !           288:            exit 1
        !           289:     esac
        !           290:     MODULE="$MODULEKIND"$TARGET
        !           291: fi
        !           292: 
        !           293: if test -n "$IONLY"
        !           294: then
        !           295:     if test -n "$TARGET"
        !           296:     then
        !           297:        echo "makeml: -target and -ionly options are incompatible"
        !           298:        exit 1
        !           299:     fi
        !           300:     MODULE="IntNull"
        !           301: fi
        !           302: 
        !           303: MOFILES="$MODULE.mos"
        !           304: DEFS="$DEFS -D$OPSYS"
        !           305: 
        !           306: 
        !           307: if test -n "$CLEAN"
        !           308: then
        !           309:     echo "(cd $RUNTIME; make clean)"
        !           310:     (cd $RUNTIME; make clean)
        !           311: fi
        !           312: 
        !           313: echo rm -f mo
        !           314: rm -f mo
        !           315: 
        !           316: echo ln -s $MO mo
        !           317: ln -s $MO mo
        !           318: 
        !           319: if test -n "$MKRUN"
        !           320: then
        !           321:     echo "(cd $RUNTIME; rm -f run allmo.o)"
        !           322:     (cd $RUNTIME; rm -f run allmo.o)
        !           323: 
        !           324:     if test -n "$SHARE"
        !           325:     then
        !           326:        if test "$OPSYS" = NEXT
        !           327:        then
        !           328:            echo "(cd $RUNTIME; make MACHINE=$MACHINE slinkdata)"
        !           329:            (cd $RUNTIME; make MACHINE=$MACHINE slinkdata)
        !           330: 
        !           331:            echo "$RUNTIME/slinkdata [$RUNTIME/$MOFILES] > $RUNTIME/allmo.s"
        !           332:            $RUNTIME/slinkdata `cat $RUNTIME/$MOFILES` > $RUNTIME/allmo.s
        !           333: 
        !           334:            echo "(cd runtime; cc -c allmo.s)"
        !           335:            (cd runtime; cc -c allmo.s)
        !           336:        else
        !           337: 
        !           338: #
        !           339: # drt: changed this to pass $DEFS value and machine name instead of
        !           340: # just the machine name.
        !           341: # 
        !           342: 
        !           343:            ARG="MACHINE=$MACHINE 'DEFS=$DEFS' linkdata"
        !           344:            echo "(cd $RUNTIME; make $ARG)"
        !           345:            (cd $RUNTIME; eval make $ARG)
        !           346: 
        !           347:            echo "$RUNTIME/linkdata [$RUNTIME/$MOFILES] > $RUNTIME/allmo.o"
        !           348:            $RUNTIME/linkdata `cat $RUNTIME/$MOFILES` > $RUNTIME/allmo.o
        !           349:        fi
        !           350:     fi
        !           351: 
        !           352:     ARG="MACHINE=$MACHINE 'DEFS=$DEFS' 'CFL=$CFL' 'ASMBLR=$ASMBLR'"
        !           353:     echo "(cd $RUNTIME; make $ARG)"
        !           354:     (cd $RUNTIME; eval make $ARG)
        !           355: fi
        !           356: 
        !           357: if test -n "$NOBOOT"
        !           358: then
        !           359:     exit 0
        !           360: fi
        !           361: 
        !           362: if test "$MODULEKIND" = Int
        !           363: then
        !           364:     STARTUP='('$COMMAND' exportML "'$IMAGE'"; output std_out System.version; output std_out (chr 10) (* newline *));'
        !           365:     echo echo $STARTUP '|' $RUNTIME/run -m $SOFTLIMIT -r $RATIO -h $HEAP $MODULE
        !           366:     echo $STARTUP | $RUNTIME/run -m $SOFTLIMIT -r $RATIO -h $HEAP $MODULE
        !           367: else
        !           368:     echo "$RUNTIME/run -m $SOFTLIMIT -r $RATIO -h $HEAP $MODULE"
        !           369:     $RUNTIME/run -m $SOFTLIMIT -r $RATIO -h $HEAP $MODULE <<XXX
        !           370: >$IMAGE
        !           371: XXX
        !           372: fi

unix.superglobalmegacorp.com

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