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