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