| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2018 The Fellowship of SML/NJ (https://smlnj.org) |
| 4 | # |
| 5 | # build script for ml-ulex |
| 6 | # |
| 7 | # options: |
| 8 | # -o image -- specify the name of the heap image, "ml-ulex" |
| 9 | # is the default. |
| 10 | |
| 11 | CMD=$0 |
| 12 | |
| 13 | ROOT="ml-ulex" |
| 14 | HEAP_IMAGE="" |
| 15 | SMLNJROOT=`pwd`/../.. |
| 16 | BIN=${INSTALLDIR:-$SMLNJROOT}/bin |
| 17 | LIB=${INSTALLDIR:-$SMLNJROOT}/lib |
| 18 | BUILD=$BIN/ml-build |
| 19 | SML=$BIN/sml |
| 20 | SIZE_OPT="-32" |
| 21 | |
| 22 | # |
| 23 | # process command-line options |
| 24 | # |
| 25 | while [ "$#" != "0" ] ; do |
| 26 | arg=$1 |
| 27 | shift |
| 28 | case $arg in |
| 29 | -32) SIZE_OPT=$arg ;; |
| 30 | -64) SIZE_OPT=$arg ;; |
| 31 | -o) |
| 32 | if [ "$#" = "0" ]; then |
| 33 | echo "$CMD: must supply image name for -o option" |
| 34 | exit 1 |
| 35 | fi |
| 36 | HEAP_IMAGE=$1; shift |
| 37 | ;; |
| 38 | *) |
| 39 | echo $CMD: invalid argument: $arg |
| 40 | exit 1 |
| 41 | ;; |
| 42 | esac |
| 43 | done |
| 44 | |
| 45 | if [ "$HEAP_IMAGE" = "" ]; then |
| 46 | HEAP_IMAGE="$ROOT" |
| 47 | fi |
| 48 | |
| 49 | # |
| 50 | # Build the ml-ulex standalone program: |
| 51 | "$BUILD" $SIZE_OPT -DNO_ML_ANTLR -DNO_ML_LEX -DNO_ML_YACC sources.cm Main.main $HEAP_IMAGE |
| 52 | |
| 53 | exit 0 |