lib/Tools/mkdir
author haftmann
Wed, 01 Jun 2005 14:16:45 +0200
changeset 16171 3c939bb52420
parent 15920 c79fa63504c8
child 16482 ed08c8edc289
permissions -rwxr-xr-x
remove CVS id from *.sty latex styles
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10555
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10511
diff changeset
     1
#!/usr/bin/env bash
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
     2
#
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
     3
# $Id$
9788
wenzelm
parents: 9656
diff changeset
     4
# Author: Markus Wenzel, TU Muenchen
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
     5
#
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
     6
# DESCRIPTION: prepare logic session directory
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
     7
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
     8
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
     9
## diagnostics
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    10
10511
wenzelm
parents: 10423
diff changeset
    11
PRG="$(basename "$0")"
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    12
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    13
function usage()
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    14
{
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    15
  echo
9237
161fb7f00414 fixed usage;
wenzelm
parents: 8685
diff changeset
    16
  echo "Usage: $PRG [OPTIONS] [LOGIC] NAME"
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    17
  echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    18
  echo "  Options are:"
8198
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
    19
  echo "    -I FILE      alternative IsaMakefile output"
8211
714f164f0385 rename -p to -P;
wenzelm
parents: 8199
diff changeset
    20
  echo "    -P           include parent logic target"
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    21
  echo "    -b           setup build mode (session outputs heap image)"
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
    22
  echo "    -q           quiet mode"
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    23
  echo
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
    24
  echo "  Prepare session directory, including IsaMakefile and document source"
8199
wenzelm
parents: 8198
diff changeset
    25
  echo "  with parent LOGIC (default ISABELLE_LOGIC=$ISABELLE_LOGIC)"
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    26
  echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    27
  exit 1
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    28
}
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    29
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    30
function fail()
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    31
{
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    32
  echo "$1" >&2
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    33
  exit 2
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    34
}
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    35
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    36
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    37
## process command line
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    38
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    39
# options
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    40
8198
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
    41
ISAMAKEFILE="IsaMakefile"
8211
714f164f0385 rename -p to -P;
wenzelm
parents: 8199
diff changeset
    42
PARENT=""
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    43
BUILD=""
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
    44
QUIET=""
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    45
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
    46
while getopts "I:Pbq" OPT
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    47
do
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    48
  case "$OPT" in
8198
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
    49
    I)
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
    50
      ISAMAKEFILE="$OPTARG"
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
    51
      ;;
8211
714f164f0385 rename -p to -P;
wenzelm
parents: 8199
diff changeset
    52
    P)
714f164f0385 rename -p to -P;
wenzelm
parents: 8199
diff changeset
    53
      PARENT=true
714f164f0385 rename -p to -P;
wenzelm
parents: 8199
diff changeset
    54
      ;;
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    55
    b)
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    56
      BUILD=true
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    57
      ;;
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
    58
    q)
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
    59
      QUIET=true
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    60
      ;;
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    61
    \?)
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    62
      usage
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    63
      ;;
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    64
  esac
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    65
done
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    66
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    67
shift $(($OPTIND - 1))
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    68
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    69
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    70
# args
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    71
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    72
9788
wenzelm
parents: 9656
diff changeset
    73
if [ "$#" -eq 1 ]; then
8194
0c5d9d23b715 misc improvements;
wenzelm
parents: 8162
diff changeset
    74
  LOGIC="$ISABELLE_LOGIC"
8685
05b6e5bcab66 handle dir prefix;
wenzelm
parents: 8579
diff changeset
    75
  DIR_NAME="$1"; shift
9788
wenzelm
parents: 9656
diff changeset
    76
elif [ "$#" -eq 2 ]; then
8194
0c5d9d23b715 misc improvements;
wenzelm
parents: 8162
diff changeset
    77
  LOGIC="$1"; shift
8685
05b6e5bcab66 handle dir prefix;
wenzelm
parents: 8579
diff changeset
    78
  DIR_NAME="$1"; shift
8194
0c5d9d23b715 misc improvements;
wenzelm
parents: 8162
diff changeset
    79
else
0c5d9d23b715 misc improvements;
wenzelm
parents: 8162
diff changeset
    80
  usage
0c5d9d23b715 misc improvements;
wenzelm
parents: 8162
diff changeset
    81
fi
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    82
8685
05b6e5bcab66 handle dir prefix;
wenzelm
parents: 8579
diff changeset
    83
DIR=$(dirname "$DIR_NAME")
05b6e5bcab66 handle dir prefix;
wenzelm
parents: 8579
diff changeset
    84
NAME=$(basename "$DIR_NAME")
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    85
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    86
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    87
## main
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    88
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
    89
[ -z "$QUIET" ] && echo "Preparing session \"$NAME\" ..."
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
    90
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
    91
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    92
# IsaMakefile
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
    93
8685
05b6e5bcab66 handle dir prefix;
wenzelm
parents: 8579
diff changeset
    94
mkdir -p "$DIR" || fail "Bad directory: $DIR"
05b6e5bcab66 handle dir prefix;
wenzelm
parents: 8579
diff changeset
    95
cd "$DIR"
05b6e5bcab66 handle dir prefix;
wenzelm
parents: 8579
diff changeset
    96
8244
c587f5ac4a98 basic source deps;
wenzelm
parents: 8211
diff changeset
    97
DOCUMENT_ROOT=""
11846
2ce611f870e0 option -q also excludes -v true in generated stuff;
wenzelm
parents: 11836
diff changeset
    98
VERBOSE=""
2ce611f870e0 option -q also excludes -v true in generated stuff;
wenzelm
parents: 11836
diff changeset
    99
[ -z "$QUIET" ] && VERBOSE="-v true "
8244
c587f5ac4a98 basic source deps;
wenzelm
parents: 8211
diff changeset
   100
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   101
if [ -n "$BUILD" ]; then
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   102
  IMAGES="$NAME"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   103
  TEST=""
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   104
  TARGET="\$(OUT)/$NAME"
8244
c587f5ac4a98 basic source deps;
wenzelm
parents: 8211
diff changeset
   105
  ROOT_ML="ROOT.ML"
8579
81ef0fc80822 tuned targets;
wenzelm
parents: 8501
diff changeset
   106
  SOURCES="*.thy"
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   107
  DOCUMENT_ROOT="document/root.tex"
8194
0c5d9d23b715 misc improvements;
wenzelm
parents: 8162
diff changeset
   108
  USEDIR="\$(USEDIR) -b -P http://isabelle.in.tum.de/library"
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   109
else
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   110
  IMAGES=""
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   111
  TEST="$NAME"
8211
714f164f0385 rename -p to -P;
wenzelm
parents: 8199
diff changeset
   112
  TARGET="\$(LOG)/$LOGIC-$NAME.gz"
8244
c587f5ac4a98 basic source deps;
wenzelm
parents: 8211
diff changeset
   113
  ROOT_ML="$NAME/ROOT.ML"
8579
81ef0fc80822 tuned targets;
wenzelm
parents: 8501
diff changeset
   114
  SOURCES="$NAME/*.thy"
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   115
  DOCUMENT_ROOT="$NAME/document/root.tex"
8194
0c5d9d23b715 misc improvements;
wenzelm
parents: 8162
diff changeset
   116
  USEDIR="\$(USEDIR)"
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   117
fi
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   118
8198
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
   119
if [ "$ISAMAKEFILE" != - -a -f "$ISAMAKEFILE" ]; then
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   120
  echo "keeping $DIR/$ISAMAKEFILE" >&2
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   121
else
11650
wenzelm
parents: 11578
diff changeset
   122
  [ -z "$QUIET" -a -n "$ISAMAKEFILE" -a "$ISAMAKEFILE" != - ] && \
wenzelm
parents: 11578
diff changeset
   123
    echo "creating $DIR/$ISAMAKEFILE" >&2
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   124
  { echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   125
    echo "## targets"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   126
    echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   127
    echo "default: $NAME"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   128
    echo "images: $IMAGES"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   129
    echo "test: $TEST"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   130
    echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   131
    echo "all: images test"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   132
    echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   133
    echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   134
    echo "## global settings"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   135
    echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   136
    echo "SRC = \$(ISABELLE_HOME)/src"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   137
    echo "OUT = \$(ISABELLE_OUTPUT)"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   138
    echo "LOG = \$(OUT)/log"
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   139
    echo
15703
727ef1b8b3ee *** empty log message ***
wenzelm
parents: 15574
diff changeset
   140
    echo "USEDIR = \$(ISATOOL) usedir ${VERBOSE}-i true -d $ISABELLE_DOC_FORMAT  ## -D generated"
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   141
    echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   142
    echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   143
    echo "## $NAME"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   144
    echo ""
8162
020e384e67dd -p option;
wenzelm
parents: 8159
diff changeset
   145
    if [ -n "$PARENT" ]; then
020e384e67dd -p option;
wenzelm
parents: 8159
diff changeset
   146
      echo "$NAME: $LOGIC $TARGET"
020e384e67dd -p option;
wenzelm
parents: 8159
diff changeset
   147
      echo
020e384e67dd -p option;
wenzelm
parents: 8159
diff changeset
   148
      echo "$LOGIC:"
020e384e67dd -p option;
wenzelm
parents: 8159
diff changeset
   149
      echo -e "\t@cd \$(SRC)/$LOGIC; \$(ISATOOL) make $LOGIC"
020e384e67dd -p option;
wenzelm
parents: 8159
diff changeset
   150
      echo
13946
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   151
      echo "$TARGET: \$(OUT)/$LOGIC $ROOT_ML $DOCUMENT_ROOT ## $SOURCES"
8194
0c5d9d23b715 misc improvements;
wenzelm
parents: 8162
diff changeset
   152
      echo -e "\t@$USEDIR \$(OUT)/$LOGIC $NAME"
8162
020e384e67dd -p option;
wenzelm
parents: 8159
diff changeset
   153
    else
020e384e67dd -p option;
wenzelm
parents: 8159
diff changeset
   154
      echo "$NAME: $TARGET"
020e384e67dd -p option;
wenzelm
parents: 8159
diff changeset
   155
      echo
13946
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   156
      echo "$TARGET: ## $ROOT_ML $DOCUMENT_ROOT $SOURCES"
8194
0c5d9d23b715 misc improvements;
wenzelm
parents: 8162
diff changeset
   157
      echo -e "\t@$USEDIR $LOGIC $NAME"
8162
020e384e67dd -p option;
wenzelm
parents: 8159
diff changeset
   158
    fi
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   159
    echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   160
    echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   161
    echo "## clean"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   162
    echo
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   163
    echo "clean:"
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   164
    echo -e "\t@rm -f $TARGET"
8198
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
   165
  } | {
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
   166
    if [ -z "$ISAMAKEFILE" -o "$ISAMAKEFILE" = - ]; then
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
   167
      cat
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
   168
    else
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
   169
      cat > "$ISAMAKEFILE"
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
   170
    fi
73a5877ca517 -I option;
wenzelm
parents: 8194
diff changeset
   171
  }
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   172
fi
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   173
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   174
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   175
# base directory
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   176
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   177
if [ -z "$BUILD" ]; then
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   178
  mkdir -p "$NAME" || fail "Bad directory: $DIR/$NAME"
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   179
  cd "$NAME"
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   180
  PREFIX="$DIR/$NAME"
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   181
else
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   182
  PREFIX="$DIR"
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   183
fi
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   184
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   185
if [ -f ROOT.ML ]; then
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   186
  echo "keeping $PREFIX/ROOT.ML" >&2
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   187
else
11650
wenzelm
parents: 11578
diff changeset
   188
  [ -z "$QUIET" ] && echo "creating $PREFIX/ROOT.ML" >&2
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   189
  cat >ROOT.ML <<EOF
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   190
(*
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   191
  no_document use_thy "ThisTheory";
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   192
  use_thy "ThatTheory";
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   193
*)
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   194
EOF
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   195
fi
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   196
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   197
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   198
# document directory
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   199
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   200
#set by configure
15847
c05c7670f166 restored AUTO_BASH/PERL -- beware of ./configure!
wenzelm
parents: 15779
diff changeset
   201
AUTO_PERL=perl
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   202
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   203
if [ -e document ]; then
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   204
  echo "keeping $PREFIX/document" >&2
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   205
else
11650
wenzelm
parents: 11578
diff changeset
   206
  [ -z "$QUIET" ] && echo "creating $PREFIX/document" >&2
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   207
  mkdir document || fail "Bad directory: $PREFIX/document"
11650
wenzelm
parents: 11578
diff changeset
   208
wenzelm
parents: 11578
diff changeset
   209
  [ -z "$QUIET" ] && echo "creating $PREFIX/document/root.tex" >&2
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   210
  TITLE=$(echo "$NAME" | tr _ -)
15920
c79fa63504c8 make mkdir usable with cygwin
haftmann
parents: 15847
diff changeset
   211
  # a hack to extract the current user name
c79fa63504c8 make mkdir usable with cygwin
haftmann
parents: 15847
diff changeset
   212
  PERLLINE='@pw = getpwnam("'$USER'"); $uname = $pw[6];
c79fa63504c8 make mkdir usable with cygwin
haftmann
parents: 15847
diff changeset
   213
    $uname =~ tr/_/-/; $uname =~ s/^[^\\]*\\//g; $uname =~ s/,S[0-9\-]+$//g; print $uname;'
c79fa63504c8 make mkdir usable with cygwin
haftmann
parents: 15847
diff changeset
   214
  AUTHOR=$("$AUTO_PERL" -e "$PERLLINE")
c79fa63504c8 make mkdir usable with cygwin
haftmann
parents: 15847
diff changeset
   215
  # the perl "getpwnam" function extracts a data entry
c79fa63504c8 make mkdir usable with cygwin
haftmann
parents: 15847
diff changeset
   216
  # from /etc/passwd; the first tr is to replace some characters
c79fa63504c8 make mkdir usable with cygwin
haftmann
parents: 15847
diff changeset
   217
  # undigestible for tex; the two regexp substs eliminate the
c79fa63504c8 make mkdir usable with cygwin
haftmann
parents: 15847
diff changeset
   218
  # windows domain-specific noise as found in /etc/passwd using cygwin
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   219
  cat >document/root.tex <<EOF
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   220
\documentclass[11pt,a4paper]{article}
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   221
\usepackage{isabelle,isabellesym}
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   222
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   223
% further packages required for unusual symbols (see also isabellesym.sty)
13946
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   224
% use only when needed
13948
8d5de16583ef reduced package dependencies,
kleing
parents: 13946
diff changeset
   225
%\usepackage{amssymb}                  % for \<leadsto>, \<box>, \<diamond>,
13946
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   226
                                       % \<sqsupset>, \<mho>, \<Join>, 
13948
8d5de16583ef reduced package dependencies,
kleing
parents: 13946
diff changeset
   227
                                       % \<lhd>, \<lesssim>, \<greatersim>,
13946
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   228
                                       % \<lessapprox>, \<greaterapprox>,
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   229
                                       % \<triangleq>, \<yen>, \<lozenge>
13948
8d5de16583ef reduced package dependencies,
kleing
parents: 13946
diff changeset
   230
%\usepackage[greek,english]{babel}     % greek for \<euro>,
8d5de16583ef reduced package dependencies,
kleing
parents: 13946
diff changeset
   231
                                       % english for \<guillemotleft>, 
8d5de16583ef reduced package dependencies,
kleing
parents: 13946
diff changeset
   232
                                       %             \<guillemotright>
8d5de16583ef reduced package dependencies,
kleing
parents: 13946
diff changeset
   233
                                       % default language = last
13946
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   234
%\usepackage[latin1]{inputenc}         % for \<onesuperior>, \<onequarter>,
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   235
                                       % \<twosuperior>, \<onehalf>,
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   236
                                       % \<threesuperior>, \<threequarters>,
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   237
                                       % \<degree>
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   238
%\usepackage[only,bigsqcap]{stmaryrd}  % for \<Sqinter>
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   239
%\usepackage{eufrak}                   % for \<AA> ... \<ZZ>, \<aa> ... \<zz>
13948
8d5de16583ef reduced package dependencies,
kleing
parents: 13946
diff changeset
   240
                                       % (only needed if amssymb not used)
8d5de16583ef reduced package dependencies,
kleing
parents: 13946
diff changeset
   241
%\usepackage{textcomp}                 % for \<cent>, \<currency>
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   242
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   243
% this should be the last package used
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   244
\usepackage{pdfsetup}
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   245
13946
b75562218711 more documentation for packages in root.tex
kleing
parents: 12477
diff changeset
   246
% urls in roman style, theory text in math-similar italics
10021
6d5d618b302c best-style made default;
wenzelm
parents: 9788
diff changeset
   247
\urlstyle{rm}
6d5d618b302c best-style made default;
wenzelm
parents: 9788
diff changeset
   248
\isabellestyle{it}
9656
a3d868043c49 %\urlstyle{rm}
wenzelm
parents: 9237
diff changeset
   249
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   250
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   251
\begin{document}
10353
b1b3f25750f4 tuned tex template;
wenzelm
parents: 10308
diff changeset
   252
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   253
\title{$TITLE}
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   254
\author{$AUTHOR}
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   255
\maketitle
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   256
10308
c50fc8023ac0 make sure default document works;
wenzelm
parents: 10021
diff changeset
   257
\tableofcontents
10353
b1b3f25750f4 tuned tex template;
wenzelm
parents: 10308
diff changeset
   258
b1b3f25750f4 tuned tex template;
wenzelm
parents: 10308
diff changeset
   259
\parindent 0pt\parskip 0.5ex
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   260
14936
wenzelm
parents: 13948
diff changeset
   261
% generated text of all theories
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   262
\input{session}
10353
b1b3f25750f4 tuned tex template;
wenzelm
parents: 10308
diff changeset
   263
14936
wenzelm
parents: 13948
diff changeset
   264
% optional bibliography
12104
c058fd42b5fc \bibliographystyle{abbrv};
wenzelm
parents: 11878
diff changeset
   265
%\bibliographystyle{abbrv}
10353
b1b3f25750f4 tuned tex template;
wenzelm
parents: 10308
diff changeset
   266
%\bibliography{root}
b1b3f25750f4 tuned tex template;
wenzelm
parents: 10308
diff changeset
   267
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   268
\end{document}
14936
wenzelm
parents: 13948
diff changeset
   269
wenzelm
parents: 13948
diff changeset
   270
%%% Local Variables:
wenzelm
parents: 13948
diff changeset
   271
%%% mode: latex
wenzelm
parents: 13948
diff changeset
   272
%%% TeX-master: t
wenzelm
parents: 13948
diff changeset
   273
%%% End:
8159
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   274
EOF
64c272504383 mkdir: prepare logic session directory;
wenzelm
parents:
diff changeset
   275
fi
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   276
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   277
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   278
# notes
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   279
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   280
if [ -z "$QUIET" ]; then
11650
wenzelm
parents: 11578
diff changeset
   281
  cat >&2 <<EOF
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   282
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   283
Notes:
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   284
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   285
  * 'isatool make' processes the session (including document preparation)
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   286
11650
wenzelm
parents: 11578
diff changeset
   287
  * $DIR/IsaMakefile contains compilation options and file dependencies
wenzelm
parents: 11578
diff changeset
   288
11846
2ce611f870e0 option -q also excludes -v true in generated stuff;
wenzelm
parents: 11836
diff changeset
   289
  * $PREFIX/document/root.tex contains the LaTeX master document setup
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   290
11846
2ce611f870e0 option -q also excludes -v true in generated stuff;
wenzelm
parents: 11836
diff changeset
   291
  * $PREFIX/ROOT.ML needs to contain ML code to load all theories
11578
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   292
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   293
EOF
43c6735080b8 removed option -d (now standard behaviour);
wenzelm
parents: 10576
diff changeset
   294
fi