build
author haftmann
Tue Sep 19 15:21:42 2006 +0200 (2006-09-19)
changeset 20588 c847c56edf0c
parent 18321 3414557c2dda
child 26211 ffd91f7a78a2
permissions -rwxr-xr-x
added operational equality
     1 #!/usr/bin/env bash
     2 #
     3 # $Id$
     4 # Author: Markus Wenzel, TU Muenchen
     5 #
     6 # build - compile the Isabelle system and object-logics
     7 
     8 if [ -L "$0" ]; then
     9   TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
    10   exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
    11 fi
    12 
    13 
    14 ## global settings
    15 
    16 ALL_LOGICS="Pure FOL HOL ZF CCL CTT Cube FOLP HOLCF LCF Sequents"
    17 
    18 
    19 ## settings
    20 
    21 export THIS_IS_ISABELLE_BUILD=true
    22 
    23 PRG="$(basename "$0")"
    24 
    25 ISABELLE_HOME="$(cd "$(dirname "$0")"; pwd -P)"
    26 source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
    27 
    28 
    29 ## diagnostics
    30 
    31 function usage()
    32 {
    33   echo
    34   echo "Usage: $PRG [OPTIONS] [LOGICS ...]"
    35   echo
    36   echo "  Options are:"
    37   echo "    -a           all logics"
    38   echo "    -b           batch mode"
    39   echo "    -i           make images"
    40   echo "    -m TARGET    make this target"
    41   echo "    -t           make test"
    42   echo
    43   echo "  Compile the named LOGICS (default $ISABELLE_LOGIC), or all object logics"
    44   echo "  in the distribution."
    45   echo
    46   exit 1
    47 }
    48 
    49 function fail()
    50 {
    51   echo "$1" >&2
    52   exit 2
    53 }
    54 
    55 
    56 ## process command line
    57 
    58 # options
    59 
    60 ALL=""
    61 BATCH=""
    62 TARGETS=""
    63 
    64 while getopts "abim:t" OPT
    65 do
    66   case "$OPT" in
    67     a)
    68       ALL=true
    69       ;;
    70     b)
    71       BATCH=true
    72       ;;
    73     i)
    74       TARGETS="$TARGETS images"
    75       ;;
    76     m)
    77       TARGETS="$TARGETS $OPTARG"
    78       ;;
    79     t)
    80       TARGETS="$TARGETS test"
    81       ;;
    82     \?)
    83       usage
    84       ;;
    85   esac
    86 done
    87 
    88 shift $(($OPTIND - 1))
    89 
    90 
    91 # args
    92 
    93 LOGICS="$@"
    94 
    95 [ -n "$ALL" ] && LOGICS="$LOGICS $ALL_LOGICS"
    96 [ -z "$LOGICS" ] && LOGICS="$ISABELLE_LOGIC"
    97 
    98 
    99 ## main
   100 
   101 # tell the user about current values
   102 
   103 if [ -z "$BATCH" ]; then
   104   echo
   105   echo "                *****************************"
   106   echo "                * Welcome to Isabelle build *"
   107   echo "                *****************************"
   108   echo
   109   echo "Please check $ISABELLE_HOME/etc/settings"
   110   [ -f "$ISABELLE_HOME_USER/etc/settings" ] && echo "AND $ISABELLE_HOME_USER/etc/settings"
   111   echo "to make sure that Isabelle's ML system settings and compilation options"
   112   echo "are appropriate."
   113   echo
   114   echo "The current values are:"
   115   echo
   116   echo "  ML_SYSTEM=$ML_SYSTEM"
   117   echo "  ML_HOME=$ML_HOME"
   118   echo "  ML_OPTIONS=$ML_OPTIONS"
   119   echo "  ML_PLATFORM=$ML_PLATFORM"
   120   echo
   121   echo "  ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS"
   122   echo "  HOL_USEDIR_OPTIONS=$HOL_USEDIR_OPTIONS"
   123 fi
   124 
   125 
   126 # check logics
   127 
   128 if [ -z "$BATCH" ]; then
   129   echo
   130   echo
   131   echo "Press RETURN to compilation of"
   132   echo
   133 fi
   134 
   135 
   136 MAKE_LOGICS=""
   137 
   138 for L in $LOGICS
   139 do
   140   DIR="$ISABELLE_HOME/src/$L"
   141   if [ -f "$DIR/IsaMakefile" ]; then
   142     MAKE_LOGICS="$MAKE_LOGICS $L"
   143   else
   144     echo "No such logic: $L"
   145   fi
   146 done
   147 
   148 
   149 if [ -z "$BATCH" ]; then
   150   echo " $MAKE_LOGICS"
   151   [ -n "$TARGETS" ] && echo "  (targets:$TARGETS)"
   152   echo
   153   read
   154 else
   155   echo
   156   echo "Isabelle build: $MAKE_LOGICS"
   157   [ -n "$TARGETS" ] && echo "(targets:$TARGETS)"
   158   echo
   159   echo "ML_SYSTEM=$ML_SYSTEM"
   160   echo "ML_HOME=$ML_HOME"
   161   echo "ML_OPTIONS=$ML_OPTIONS"
   162   echo "ML_PLATFORM=$ML_PLATFORM"
   163   echo
   164   echo "ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS"
   165   echo "HOL_USEDIR_OPTIONS=$HOL_USEDIR_OPTIONS"
   166   echo
   167 fi
   168 
   169 
   170 # build it
   171 
   172 echo "Started at $(date) ($ML_IDENTIFIER on $(hostname))"
   173 . "$ISABELLE_HOME/lib/scripts/timestart.bash"
   174 
   175 for L in $MAKE_LOGICS
   176 do
   177   ( cd "$ISABELLE_HOME/src/$L"; "$ISATOOL" make $TARGETS )
   178 done
   179 
   180 echo -n "Finished at "; date
   181 
   182 . "$ISABELLE_HOME/lib/scripts/timestop.bash"
   183 echo "$TIMES_REPORT"