build
author huffman
Wed Oct 13 10:27:26 2010 -0700 (2010-10-13)
changeset 40010 d7fdd84b959f
parent 34238 b28be884edda
child 40775 ed7a4eadb2f6
permissions -rwxr-xr-x
edit comments
     1 #!/usr/bin/env bash
     2 #
     3 # Author: Markus Wenzel, TU Muenchen
     4 #
     5 # build - compile the Isabelle system and object-logics
     6 
     7 if [ -L "$0" ]; then
     8   TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
     9   exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
    10 fi
    11 
    12 
    13 ## global settings
    14 
    15 ALL_LOGICS="Pure FOL HOL ZF CCL CTT Cube FOLP HOLCF LCF Sequents"
    16 
    17 
    18 ## settings
    19 
    20 PRG="$(basename "$0")"
    21 
    22 ISABELLE_HOME="$(cd "$(dirname "$0")"; pwd -P)"
    23 source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
    24 
    25 ISABELLE_OUTPUT="$ISABELLE_HOME/heaps/$ML_IDENTIFIER"
    26 ISABELLE_BROWSER_INFO="$ISABELLE_HOME/browser_info"
    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 fi
   123 
   124 
   125 # check logics
   126 
   127 if [ -z "$BATCH" ]; then
   128   echo
   129   echo
   130   echo "Press RETURN to compilation of"
   131   echo
   132 fi
   133 
   134 
   135 MAKE_LOGICS=""
   136 
   137 for L in $LOGICS
   138 do
   139   DIR="$ISABELLE_HOME/src/$L"
   140   if [ -f "$DIR/IsaMakefile" ]; then
   141     MAKE_LOGICS="$MAKE_LOGICS $L"
   142   else
   143     echo "No such logic: $L"
   144   fi
   145 done
   146 
   147 
   148 if [ -z "$BATCH" ]; then
   149   echo " $MAKE_LOGICS"
   150   [ -n "$TARGETS" ] && echo "  (targets:$TARGETS)"
   151   echo
   152   read
   153 else
   154   echo
   155   echo "Isabelle build: $MAKE_LOGICS"
   156   [ -n "$TARGETS" ] && echo "(targets:$TARGETS)"
   157   echo
   158   echo "ML_SYSTEM=$ML_SYSTEM"
   159   echo "ML_HOME=$ML_HOME"
   160   echo "ML_OPTIONS=$ML_OPTIONS"
   161   echo "ML_PLATFORM=$ML_PLATFORM"
   162   echo
   163   echo "ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS"
   164   echo
   165 fi
   166 
   167 
   168 # build it
   169 
   170 echo "Started at $(date) ($ML_IDENTIFIER on $(hostname))"
   171 . "$ISABELLE_HOME/lib/scripts/timestart.bash"
   172 
   173 for L in $MAKE_LOGICS
   174 do
   175   ( cd "$ISABELLE_HOME/src/$L"; "$ISABELLE_TOOL" make $TARGETS )
   176 done
   177 
   178 echo -n "Finished at "; date
   179 
   180 . "$ISABELLE_HOME/lib/scripts/timestop.bash"
   181 echo "$TIMES_REPORT"