build
author wenzelm
Tue, 22 Jul 1997 19:33:30 +0200
changeset 3552 f348e8a2db4b
parent 3255 7678f3d93053
child 4457 6e6d99e06d0c
permissions -rwxr-xr-x
tuned error / warning;

#!/bin/bash
#
# $Id$
#
# build - compile the Isabelle system and object-logics


## settings

PRG=$(basename $0)

ISABELLE_HOME=$(dirname $0)
. $ISABELLE_HOME/lib/scripts/getsettings || \
  { echo "$PRG probably not called from its original place!"; exit 2; }


## diagnostics

function usage()
{
  echo
  echo "Usage: $PRG [OPTIONS] [LOGICS ...]"
  echo
  echo "  Options are:"
  echo "    -a           all logics"
  echo "    -b           batch mode"
  echo "    -t           run tests"
  echo
  echo "  Compile the named LOGICS (default $ISABELLE_LOGIC), or all object logics"
  echo "  in the distribution."
  echo
  exit 1
}

function fail()
{
  echo "$1" >&2
  exit 2
}


## process command line

# options

ALL=""
BATCH=""
TEST=""

while getopts "abt" OPT
do
  case "$OPT" in
    a)
      ALL=true
      ;;
    b)
      BATCH=true
      ;;
    t)
      TEST=test
      ;;
    \?)
      usage
      ;;
  esac
done

shift $(($OPTIND - 1))


# args

LOGICS="$@"


## main

# tell the user about current values

if [ -z "$BATCH" ]; then
  echo
  echo "                *****************************"
  echo "                * Welcome to Isabelle build *"
  echo "                *****************************"
  echo
  echo "Please check $ISABELLE_HOME/etc/settings"
  [ -f $ISABELLE_HOME_USER/etc/settings ] && echo "AND $ISABELLE_HOME_USER/etc/settings"
  echo "to make sure that Isabelle's ML system settings are appropriate."
  echo
  echo "Your current values are:"
  echo
  echo "  ML_SYSTEM=$ML_SYSTEM"
  echo "  ML_HOME=$ML_HOME"
  echo "  ML_OPTIONS=$ML_OPTIONS"
fi


# check logics

if [ -z "$BATCH" ]; then
  echo
  echo
  echo "Press RETURN to start compilation (including parents) of:"
  echo
fi

[ -z "$LOGICS" ] && LOGICS=$ISABELLE_LOGIC

if [ -n "$ALL" ]; then
  LOGICS=""
  for DIR in $ISABELLE_HOME/src/*
  do
    if [ -f $DIR/IsaMakefile ]; then
      L=$(basename $DIR)
      LOGICS="$LOGICS $L"
    fi
  done
else
  for L in $LOGICS
  do
    DIR=$ISABELLE_HOME/src/$L
    [ ! -f $DIR/IsaMakefile ] && fail "No such logic: $L"
  done
fi

if [ -z "$BATCH" ]; then
  echo " " $LOGICS
  echo
  read
else
  echo
  echo "Isabelle build:" $LOGICS
  echo
  echo "ML_SYSTEM=$ML_SYSTEM"
  echo "ML_HOME=$ML_HOME"
  echo "ML_OPTIONS=$ML_OPTIONS"
  echo
fi


# build it

echo
echo -n "Started at "; date
echo

export THIS_IS_ISABELLE_BUILD=true

for L in $LOGICS
do
  ( cd $ISABELLE_HOME/src/$L; $ISATOOL make $TEST )
done

echo
echo -n "Finished at "; date
echo