build
author wenzelm
Tue Apr 26 19:49:58 2005 +0200 (2005-04-26)
changeset 15844 6b1e5f703246
parent 15779 aed221aff642
child 15877 c9efc3e3fd44
permissions -rwxr-xr-x
improved handling of symlinks;
ALL_LOGICS: topological order;
removed remains of deceased -p option;
reverted accidental commit of user modification;
     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 "$(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 export THIS_IS_ISABELLE_BUILD=true
    24 
    25 ISABELLE_HOME="$(dirname "$0")"
    26 . "$ISABELLE_HOME/lib/scripts/getsettings" || \
    27   { echo "$PRG probably not called from its original place!"; exit 2; }
    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 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
   166 fi
   167 
   168 
   169 # build it
   170 
   171 SECONDS=0
   172 echo "Started at $(date) ($ML_IDENTIFIER on $(hostname))"
   173 
   174 for L in $MAKE_LOGICS
   175 do
   176   ( cd "$ISABELLE_HOME/src/$L"; "$ISATOOL" make $TARGETS )
   177 done
   178 
   179 echo -n "Finished at "; date
   180 
   181 ELAPSED=$("$ISABELLE_HOME/lib/scripts/showtime" "$SECONDS")
   182 echo "$ELAPSED total elapsed time"