author | wenzelm |
Fri, 02 May 2008 16:38:01 +0200 | |
changeset 26769 | 5b8382d495be |
parent 26211 | ffd91f7a78a2 |
child 28500 | 4b79e5d3d0aa |
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/.* -> //')" |
|
15967 | 10 |
exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; 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 |
||
15967 | 21 |
PRG="$(basename "$0")" |
22 |
||
23 |
ISABELLE_HOME="$(cd "$(dirname "$0")"; pwd -P)" |
|
24 |
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2 |
|
2755 | 25 |
|
26211
ffd91f7a78a2
removed obsolete THIS_IS_ISABELLE_BUILD feature: change environment after getsettings (works due to static scoping);
wenzelm
parents:
18321
diff
changeset
|
26 |
ISABELLE_OUTPUT="$ISABELLE_HOME/heaps/$ML_IDENTIFIER" |
ffd91f7a78a2
removed obsolete THIS_IS_ISABELLE_BUILD feature: change environment after getsettings (works due to static scoping);
wenzelm
parents:
18321
diff
changeset
|
27 |
ISABELLE_BROWSER_INFO="$ISABELLE_HOME/browser_info" |
ffd91f7a78a2
removed obsolete THIS_IS_ISABELLE_BUILD feature: change environment after getsettings (works due to static scoping);
wenzelm
parents:
18321
diff
changeset
|
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" |
|
17576 | 123 |
echo " HOL_USEDIR_OPTIONS=$HOL_USEDIR_OPTIONS" |
2902 | 124 |
fi |
2789 | 125 |
|
126 |
||
2879 | 127 |
# check logics |
2755 | 128 |
|
2902 | 129 |
if [ -z "$BATCH" ]; then |
130 |
echo |
|
131 |
echo |
|
9817 | 132 |
echo "Press RETURN to compilation of" |
2902 | 133 |
echo |
134 |
fi |
|
2879 | 135 |
|
4457 | 136 |
|
137 |
MAKE_LOGICS="" |
|
2879 | 138 |
|
4457 | 139 |
for L in $LOGICS |
140 |
do |
|
9789 | 141 |
DIR="$ISABELLE_HOME/src/$L" |
142 |
if [ -f "$DIR/IsaMakefile" ]; then |
|
4457 | 143 |
MAKE_LOGICS="$MAKE_LOGICS $L" |
144 |
else |
|
145 |
echo "No such logic: $L" |
|
146 |
fi |
|
147 |
done |
|
148 |
||
2879 | 149 |
|
2902 | 150 |
if [ -z "$BATCH" ]; then |
9789 | 151 |
echo " $MAKE_LOGICS" |
9817 | 152 |
[ -n "$TARGETS" ] && echo " (targets:$TARGETS)" |
2902 | 153 |
echo |
154 |
read |
|
155 |
else |
|
156 |
echo |
|
9789 | 157 |
echo "Isabelle build: $MAKE_LOGICS" |
9817 | 158 |
[ -n "$TARGETS" ] && echo "(targets:$TARGETS)" |
2914 | 159 |
echo |
2902 | 160 |
echo "ML_SYSTEM=$ML_SYSTEM" |
161 |
echo "ML_HOME=$ML_HOME" |
|
162 |
echo "ML_OPTIONS=$ML_OPTIONS" |
|
7311 | 163 |
echo "ML_PLATFORM=$ML_PLATFORM" |
2902 | 164 |
echo |
5393 | 165 |
echo "ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS" |
17649 | 166 |
echo "HOL_USEDIR_OPTIONS=$HOL_USEDIR_OPTIONS" |
5393 | 167 |
echo |
2902 | 168 |
fi |
2755 | 169 |
|
170 |
||
2879 | 171 |
# build it |
172 |
||
10511 | 173 |
echo "Started at $(date) ($ML_IDENTIFIER on $(hostname))" |
18321
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
17649
diff
changeset
|
174 |
. "$ISABELLE_HOME/lib/scripts/timestart.bash" |
2914 | 175 |
|
4457 | 176 |
for L in $MAKE_LOGICS |
2755 | 177 |
do |
14056 | 178 |
( cd "$ISABELLE_HOME/src/$L"; "$ISATOOL" make $TARGETS ) |
2755 | 179 |
done |
2902 | 180 |
|
2914 | 181 |
echo -n "Finished at "; date |
4457 | 182 |
|
18321
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
17649
diff
changeset
|
183 |
. "$ISABELLE_HOME/lib/scripts/timestop.bash" |
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
17649
diff
changeset
|
184 |
echo "$TIMES_REPORT" |