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