src/Pure/build
changeset 48373 527e2bad7cca
parent 48360 631d286e97b0
child 48417 bb1d4ec90f30
equal deleted inserted replaced
48370:d0fa3efec93b 48373:527e2bad7cca
    10 ## diagnostics
    10 ## diagnostics
    11 
    11 
    12 function usage()
    12 function usage()
    13 {
    13 {
    14   echo
    14   echo
    15   echo "Usage: $PRG TARGET"
    15   echo "Usage: $PRG [OPTIONS] TARGET"
       
    16   echo
       
    17   echo "  Options are:"
       
    18   echo "    -b           build target images"
    16   echo
    19   echo
    17   echo "  Build Isabelle/ML TARGET: RAW or Pure"
    20   echo "  Build Isabelle/ML TARGET: RAW or Pure"
    18   echo
    21   echo
    19   exit 1
    22   exit 1
    20 }
    23 }
    27 
    30 
    28 [ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment"
    31 [ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment"
    29 
    32 
    30 
    33 
    31 ## process command line
    34 ## process command line
       
    35 
       
    36 # options
       
    37 
       
    38 BUILD_IMAGES=false
       
    39 
       
    40 while getopts "b" OPT
       
    41 do
       
    42   case "$OPT" in
       
    43     b)
       
    44       BUILD_IMAGES="true"
       
    45       ;;
       
    46     \?)
       
    47       usage
       
    48       ;;
       
    49   esac
       
    50 done
       
    51 
       
    52 shift $(($OPTIND - 1))
       
    53 
       
    54 
       
    55 # args
    32 
    56 
    33 TARGET="Pure"
    57 TARGET="Pure"
    34 [ "$#" -ge 1 ] && { TARGET="$1"; shift; }
    58 [ "$#" -ge 1 ] && { TARGET="$1"; shift; }
    35 [ "$TARGET" = RAW -o "$TARGET" = Pure ] || fail "Bad target: \"$TARGET\""
    59 [ "$TARGET" = RAW -o "$TARGET" = Pure ] || fail "Bad target: \"$TARGET\""
    36 
    60 
    52 
    76 
    53 # run isabelle
    77 # run isabelle
    54 
    78 
    55 . "$ISABELLE_HOME/lib/scripts/timestart.bash"
    79 . "$ISABELLE_HOME/lib/scripts/timestart.bash"
    56 
    80 
    57 echo "Building $TARGET ..." >&2
    81 if [ "$TARGET" = RAW ]; then
       
    82   if [ "$BUILD_IMAGES" = false ]; then
       
    83     "$ISABELLE_PROCESS" \
       
    84       -e "use\"$COMPAT\" handle _ => exit 1;" \
       
    85       -q RAW_ML_SYSTEM
       
    86   else
       
    87     "$ISABELLE_PROCESS" \
       
    88       -e "use\"$COMPAT\" handle _ => exit 1;" \
       
    89       -e "structure Isar = struct fun main () = () end;" \
       
    90       -e "ml_prompts \"ML> \" \"ML# \";" \
       
    91       -q -w RAW_ML_SYSTEM RAW
       
    92   fi
       
    93 else
       
    94   if [ "$BUILD_IMAGES" = false ]; then
       
    95     "$ISABELLE_PROCESS" \
       
    96       -e "(use\"$COMPAT\"; use\"ROOT.ML\") handle _ => exit 1;" \
       
    97       -q RAW_ML_SYSTEM
       
    98   else
       
    99     "$ISABELLE_PROCESS" \
       
   100       -e "(use\"$COMPAT\"; use\"ROOT.ML\") handle _ => exit 1;" \
       
   101       -e "ml_prompts \"ML> \" \"ML# \";" \
       
   102       -f -q -w RAW_ML_SYSTEM Pure
       
   103   fi
       
   104 fi
    58 
   105 
    59 if [ "$TARGET" = RAW ]; then
   106 RC="$?"
    60   "$ISABELLE_PROCESS" \
       
    61     -e "use\"$COMPAT\" handle _ => exit 1;" \
       
    62     -e "structure Isar = struct fun main () = () end;" \
       
    63     -e "ml_prompts \"ML> \" \"ML# \";" \
       
    64     -q -w RAW_ML_SYSTEM RAW
       
    65   RC="$?"
       
    66 else
       
    67   "$ISABELLE_PROCESS" \
       
    68     -e "(use\"$COMPAT\"; use\"ROOT.ML\") handle _ => exit 1;" \
       
    69     -e "ml_prompts \"ML> \" \"ML# \";" \
       
    70     -f -q -w RAW_ML_SYSTEM Pure
       
    71   RC="$?"
       
    72 fi
       
    73 
   107 
    74 . "$ISABELLE_HOME/lib/scripts/timestop.bash"
   108 . "$ISABELLE_HOME/lib/scripts/timestop.bash"
    75 
   109 
    76 if [ "$RC" -eq 0 ]; then
   110 if [ "$RC" -eq 0 ]; then
    77   echo "Finished $TARGET ($TIMES_REPORT)" >&2
   111   echo "Finished $TARGET ($TIMES_REPORT)" >&2
    78 else
       
    79   echo "$TARGET FAILED" >&2
       
    80 fi
   112 fi
    81 
   113 
    82 exit "$RC"
   114 exit "$RC"