build
author wenzelm
Fri, 10 Nov 2000 19:02:37 +0100
changeset 10432 3dfbc913d184
parent 9817 6ad158576972
child 10511 efb3428c9879
permissions -rwxr-xr-x
added axclass inverse and consts inverse, divide (infix "/"); moved axclass power to Nat.thy;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3255
7678f3d93053 fixed bash path;
wenzelm
parents: 3184
diff changeset
     1
#!/bin/bash
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
     2
#
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
     3
# $Id$
9817
wenzelm
parents: 9789
diff changeset
     4
# Author: Markus Wenzel, TU Muenchen
wenzelm
parents: 9789
diff changeset
     5
# License: GPL (GNU GENERAL PUBLIC LICENSE)
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
     6
#
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
     7
# build - compile the Isabelle system and object-logics
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
     8
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
     9
4457
wenzelm
parents: 3255
diff changeset
    10
## global settings
wenzelm
parents: 3255
diff changeset
    11
wenzelm
parents: 3255
diff changeset
    12
ALL_LOGICS="CCL CTT Cube FOL FOLP HOL HOLCF LCF Pure Sequents ZF"
wenzelm
parents: 3255
diff changeset
    13
wenzelm
parents: 3255
diff changeset
    14
2789
69cf3aea45ee major tuning;
wenzelm
parents: 2781
diff changeset
    15
## settings
69cf3aea45ee major tuning;
wenzelm
parents: 2781
diff changeset
    16
9789
wenzelm
parents: 7889
diff changeset
    17
PRG=$(basename "$0")
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
    18
7889
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    19
export THIS_IS_ISABELLE_BUILD=true
9789
wenzelm
parents: 7889
diff changeset
    20
ISABELLE_HOME=$(dirname "$0")
wenzelm
parents: 7889
diff changeset
    21
. "$ISABELLE_HOME/lib/scripts/getsettings" || \
2936
bd33e7aae062 fixed { ... } shell syntax to accomodate bash 2.x;
wenzelm
parents: 2918
diff changeset
    22
  { echo "$PRG probably not called from its original place!"; exit 2; }
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
    23
2789
69cf3aea45ee major tuning;
wenzelm
parents: 2781
diff changeset
    24
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    25
## diagnostics
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    26
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    27
function usage()
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    28
{
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    29
  echo
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    30
  echo "Usage: $PRG [OPTIONS] [LOGICS ...]"
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    31
  echo
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    32
  echo "  Options are:"
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    33
  echo "    -a           all logics"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    34
  echo "    -b           batch mode"
6256
e17fb80b3ce1 -i option;
wenzelm
parents: 5393
diff changeset
    35
  echo "    -i           make images"
7889
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    36
  echo "    -m TARGET    make this target"
6256
e17fb80b3ce1 -i option;
wenzelm
parents: 5393
diff changeset
    37
  echo "    -t           make test"
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    38
  echo
3184
4e0bbfb113d5 renamed DEFAULT_LOGIC to ISABELLE_LOGIC;
wenzelm
parents: 3007
diff changeset
    39
  echo "  Compile the named LOGICS (default $ISABELLE_LOGIC), or all object logics"
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    40
  echo "  in the distribution."
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    41
  echo
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    42
  exit 1
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    43
}
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    44
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    45
function fail()
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    46
{
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    47
  echo "$1" >&2
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    48
  exit 2
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    49
}
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    50
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    51
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    52
## process command line
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    53
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    54
# options
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    55
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    56
ALL=""
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    57
BATCH=""
7889
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    58
TARGETS=""
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
    59
7889
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    60
while getopts "abim:t" OPT
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    61
do
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    62
  case "$OPT" in
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    63
    a)
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    64
      ALL=true
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    65
      ;;
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    66
    b)
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    67
      BATCH=true
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    68
      ;;
6256
e17fb80b3ce1 -i option;
wenzelm
parents: 5393
diff changeset
    69
    i)
7889
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    70
      TARGETS="$TARGETS images"
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    71
      ;;
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    72
    m)
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    73
      TARGETS="$TARGETS $OPTARG"
6256
e17fb80b3ce1 -i option;
wenzelm
parents: 5393
diff changeset
    74
      ;;
2918
0305b0acba78 added -t (run tests) option;
wenzelm
parents: 2914
diff changeset
    75
    t)
7889
56e91ac0f074 option -m TARGET;
wenzelm
parents: 7782
diff changeset
    76
      TARGETS="$TARGETS test"
2918
0305b0acba78 added -t (run tests) option;
wenzelm
parents: 2914
diff changeset
    77
      ;;
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    78
    \?)
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    79
      usage
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    80
      ;;
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    81
  esac
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    82
done
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    83
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    84
shift $(($OPTIND - 1))
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    85
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    86
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    87
# args
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    88
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    89
LOGICS="$@"
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    90
4457
wenzelm
parents: 3255
diff changeset
    91
[ -n "$ALL" ] && LOGICS="$LOGICS $ALL_LOGICS"
wenzelm
parents: 3255
diff changeset
    92
[ -z "$LOGICS" ] && LOGICS="$ISABELLE_LOGIC"
wenzelm
parents: 3255
diff changeset
    93
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    94
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    95
## main
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    96
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    97
# tell the user about current values
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
    98
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
    99
if [ -z "$BATCH" ]; then
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   100
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   101
  echo "                *****************************"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   102
  echo "                * Welcome to Isabelle build *"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   103
  echo "                *****************************"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   104
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   105
  echo "Please check $ISABELLE_HOME/etc/settings"
9789
wenzelm
parents: 7889
diff changeset
   106
  [ -f "$ISABELLE_HOME_USER/etc/settings" ] && echo "AND $ISABELLE_HOME_USER/etc/settings"
5386
wenzelm
parents: 4581
diff changeset
   107
  echo "to make sure that Isabelle's ML system settings and compilation options"
wenzelm
parents: 4581
diff changeset
   108
  echo "are appropriate."
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   109
  echo
5386
wenzelm
parents: 4581
diff changeset
   110
  echo "The current values are:"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   111
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   112
  echo "  ML_SYSTEM=$ML_SYSTEM"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   113
  echo "  ML_HOME=$ML_HOME"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   114
  echo "  ML_OPTIONS=$ML_OPTIONS"
7277
bb9502f9154a improved messages;
wenzelm
parents: 6256
diff changeset
   115
  echo "  ML_PLATFORM=$ML_PLATFORM"
5386
wenzelm
parents: 4581
diff changeset
   116
  echo
wenzelm
parents: 4581
diff changeset
   117
  echo "  ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   118
fi
2789
69cf3aea45ee major tuning;
wenzelm
parents: 2781
diff changeset
   119
69cf3aea45ee major tuning;
wenzelm
parents: 2781
diff changeset
   120
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   121
# check logics
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
   122
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   123
if [ -z "$BATCH" ]; then
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   124
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   125
  echo
9817
wenzelm
parents: 9789
diff changeset
   126
  echo "Press RETURN to compilation of"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   127
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   128
fi
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   129
4457
wenzelm
parents: 3255
diff changeset
   130
wenzelm
parents: 3255
diff changeset
   131
MAKE_LOGICS=""
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   132
4457
wenzelm
parents: 3255
diff changeset
   133
for L in $LOGICS
wenzelm
parents: 3255
diff changeset
   134
do
9789
wenzelm
parents: 7889
diff changeset
   135
  DIR="$ISABELLE_HOME/src/$L"
wenzelm
parents: 7889
diff changeset
   136
  if [ -f "$DIR/IsaMakefile" ]; then
4457
wenzelm
parents: 3255
diff changeset
   137
    MAKE_LOGICS="$MAKE_LOGICS $L"
wenzelm
parents: 3255
diff changeset
   138
  else
wenzelm
parents: 3255
diff changeset
   139
    echo "No such logic: $L"
wenzelm
parents: 3255
diff changeset
   140
  fi
wenzelm
parents: 3255
diff changeset
   141
done
wenzelm
parents: 3255
diff changeset
   142
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   143
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   144
if [ -z "$BATCH" ]; then
9789
wenzelm
parents: 7889
diff changeset
   145
  echo " $MAKE_LOGICS"
9817
wenzelm
parents: 9789
diff changeset
   146
  [ -n "$TARGETS" ] && echo "  (targets:$TARGETS)"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   147
  echo
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   148
  read
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   149
else
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   150
  echo
9789
wenzelm
parents: 7889
diff changeset
   151
  echo "Isabelle build: $MAKE_LOGICS"
9817
wenzelm
parents: 9789
diff changeset
   152
  [ -n "$TARGETS" ] && echo "(targets:$TARGETS)"
2914
01d24f98528f improved messages;
wenzelm
parents: 2902
diff changeset
   153
  echo
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   154
  echo "ML_SYSTEM=$ML_SYSTEM"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   155
  echo "ML_HOME=$ML_HOME"
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   156
  echo "ML_OPTIONS=$ML_OPTIONS"
7311
1ef2c659023d echo ML_PLATFORM;
wenzelm
parents: 7277
diff changeset
   157
  echo "ML_PLATFORM=$ML_PLATFORM"
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   158
  echo
5393
7299e531d481 fixed ISABELLE_USEDIR_OPTIONS;
wenzelm
parents: 5386
diff changeset
   159
  echo "ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS"
7299e531d481 fixed ISABELLE_USEDIR_OPTIONS;
wenzelm
parents: 5386
diff changeset
   160
  echo
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   161
fi
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
   162
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
   163
2879
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   164
# build it
477bfcb022d8 misc improvements;
wenzelm
parents: 2789
diff changeset
   165
4457
wenzelm
parents: 3255
diff changeset
   166
SECONDS=0
7277
bb9502f9154a improved messages;
wenzelm
parents: 6256
diff changeset
   167
DATE=$(date)
bb9502f9154a improved messages;
wenzelm
parents: 6256
diff changeset
   168
HOST=$(hostname)
bb9502f9154a improved messages;
wenzelm
parents: 6256
diff changeset
   169
echo "Started at $DATE ($HOST)"
2914
01d24f98528f improved messages;
wenzelm
parents: 2902
diff changeset
   170
4457
wenzelm
parents: 3255
diff changeset
   171
for L in $MAKE_LOGICS
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
   172
do
9789
wenzelm
parents: 7889
diff changeset
   173
  ( cd "$ISABELLE_HOME/src/$L"; "$ISATOOL" make $TARGETS )
2755
9a7128d9722e build - compile parts of the Isabelle system;
wenzelm
parents:
diff changeset
   174
done
2902
bacef535265c added -b option (batch mode);
wenzelm
parents: 2879
diff changeset
   175
2914
01d24f98528f improved messages;
wenzelm
parents: 2902
diff changeset
   176
echo -n "Finished at "; date
4457
wenzelm
parents: 3255
diff changeset
   177
9789
wenzelm
parents: 7889
diff changeset
   178
ELAPSED=$("$ISABELLE_HOME/lib/scripts/showtime" "$SECONDS")
4457
wenzelm
parents: 3255
diff changeset
   179
echo "$ELAPSED total elapsed time"