build
author wenzelm
Fri Apr 04 14:47:26 1997 +0200 (1997-04-04)
changeset 2902 bacef535265c
parent 2879 477bfcb022d8
child 2914 01d24f98528f
permissions -rwxr-xr-x
added -b option (batch mode);
     1 #!/bin/bash -norc
     2 #
     3 # $Id$
     4 #
     5 # build - compile the Isabelle system and object-logics
     6 
     7 
     8 ## settings
     9 
    10 PRG=$(basename $0)
    11 
    12 ISABELLE_HOME=$(dirname $0)
    13 . $ISABELLE_HOME/lib/scripts/getsettings || \
    14   { echo "$PRG probably not called from its original place!"; exit 2 }
    15 
    16 
    17 ## diagnostics
    18 
    19 function usage()
    20 {
    21   echo
    22   echo "Usage: $PRG [OPTIONS] [LOGICS ...]"
    23   echo
    24   echo "  Options are:"
    25   echo "    -a           all logics"
    26   echo "    -b           batch mode"
    27   echo
    28   echo "  Compile the named LOGICS (default $DEFAULT_LOGIC), or all object logics"
    29   echo "  in the distribution."
    30   echo
    31   exit 1
    32 }
    33 
    34 function fail()
    35 {
    36   echo "$1" >&2
    37   exit 2
    38 }
    39 
    40 
    41 ## process command line
    42 
    43 # options
    44 
    45 ALL=""
    46 BATCH=""
    47 
    48 while getopts "ab" OPT
    49 do
    50   case "$OPT" in
    51     a)
    52       ALL=true
    53       ;;
    54     b)
    55       BATCH=true
    56       ;;
    57     \?)
    58       usage
    59       ;;
    60   esac
    61 done
    62 
    63 shift $(($OPTIND - 1))
    64 
    65 
    66 # args
    67 
    68 LOGICS="$@"
    69 
    70 
    71 ## main
    72 
    73 # tell the user about current values
    74 
    75 if [ -z "$BATCH" ]; then
    76   echo
    77   echo "                *****************************"
    78   echo "                * Welcome to Isabelle build *"
    79   echo "                *****************************"
    80   echo
    81   echo "Please check $ISABELLE_HOME/etc/settings"
    82   [ -f $ISABELLE_HOME_USER/etc/settings ] && echo "AND $ISABELLE_HOME_USER/etc/settings"
    83   echo "to make sure that Isabelle's ML system settings are appropriate."
    84   echo
    85   echo "Your current values are:"
    86   echo
    87   echo "  ML_SYSTEM=$ML_SYSTEM"
    88   echo "  ML_HOME=$ML_HOME"
    89   echo "  ML_OPTIONS=$ML_OPTIONS"
    90 fi
    91 
    92 
    93 # check logics
    94 
    95 if [ -z "$BATCH" ]; then
    96   echo
    97   echo
    98   echo "Press RETURN to start compilation (including parents) of:"
    99   echo
   100 fi
   101 
   102 [ -z "$LOGICS" ] && LOGICS=$DEFAULT_LOGIC
   103 
   104 if [ -n "$ALL" ]; then
   105   LOGICS=""
   106   for DIR in $ISABELLE_HOME/src/*
   107   do
   108     if [ -f $DIR/IsaMakefile ]; then
   109       L=$(basename $DIR)
   110       LOGICS="$LOGICS $L"
   111     fi
   112   done
   113 else
   114   for L in $LOGICS
   115   do
   116     DIR=$ISABELLE_HOME/src/$L
   117     [ ! -f $DIR/IsaMakefile ] && fail "No such logic: $L"
   118   done
   119 fi
   120 
   121 if [ -z "$BATCH" ]; then
   122   echo " " $LOGICS
   123   echo
   124   read
   125 else
   126   echo
   127   echo -n "Isabelle build started at "; date
   128   echo "logics:" $LOGICS
   129   echo "ML_SYSTEM=$ML_SYSTEM"
   130   echo "ML_HOME=$ML_HOME"
   131   echo "ML_OPTIONS=$ML_OPTIONS"
   132   echo
   133 fi
   134 
   135 
   136 # build it
   137 
   138 export THIS_IS_ISABELLE_BUILD=true
   139 
   140 for L in $LOGICS
   141 do
   142   ( cd $ISABELLE_HOME/src/$L; $ISATOOL make )
   143 done
   144 
   145 if [ -n "$BATCH" ]; then
   146   echo
   147   echo -n "Isabelle build finished at "; date
   148 fi