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