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