author | bulwahn |
Fri, 06 Nov 2009 14:16:57 +0100 | |
changeset 33489 | d7e6c8fbf254 |
parent 29145 | b1c6f4563df7 |
child 34238 | b28be884edda |
permissions | -rwxr-xr-x |
10555 | 1 |
#!/usr/bin/env bash |
2755 | 2 |
# |
9817 | 3 |
# Author: Markus Wenzel, TU Muenchen |
2755 | 4 |
# |
2902 | 5 |
# build - compile the Isabelle system and object-logics |
2755 | 6 |
|
15844 | 7 |
if [ -L "$0" ]; then |
8 |
TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')" |
|
15967 | 9 |
exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@" |
15844 | 10 |
fi |
11 |
||
2755 | 12 |
|
4457 | 13 |
## global settings |
14 |
||
15844 | 15 |
ALL_LOGICS="Pure FOL HOL ZF CCL CTT Cube FOLP HOLCF LCF Sequents" |
4457 | 16 |
|
17 |
||
2789 | 18 |
## settings |
19 |
||
15967 | 20 |
PRG="$(basename "$0")" |
21 |
||
22 |
ISABELLE_HOME="$(cd "$(dirname "$0")"; pwd -P)" |
|
23 |
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2 |
|
2755 | 24 |
|
26211
ffd91f7a78a2
removed obsolete THIS_IS_ISABELLE_BUILD feature: change environment after getsettings (works due to static scoping);
wenzelm
parents:
18321
diff
changeset
|
25 |
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
|
26 |
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
|
27 |
|
2789 | 28 |
|
2879 | 29 |
## diagnostics |
30 |
||
31 |
function usage() |
|
32 |
{ |
|
33 |
echo |
|
34 |
echo "Usage: $PRG [OPTIONS] [LOGICS ...]" |
|
35 |
echo |
|
36 |
echo " Options are:" |
|
37 |
echo " -a all logics" |
|
2902 | 38 |
echo " -b batch mode" |
6256 | 39 |
echo " -i make images" |
7889 | 40 |
echo " -m TARGET make this target" |
6256 | 41 |
echo " -t make test" |
2879 | 42 |
echo |
3184 | 43 |
echo " Compile the named LOGICS (default $ISABELLE_LOGIC), or all object logics" |
2879 | 44 |
echo " in the distribution." |
45 |
echo |
|
46 |
exit 1 |
|
47 |
} |
|
48 |
||
49 |
function fail() |
|
50 |
{ |
|
51 |
echo "$1" >&2 |
|
52 |
exit 2 |
|
53 |
} |
|
54 |
||
55 |
||
56 |
## process command line |
|
57 |
||
58 |
# options |
|
59 |
||
60 |
ALL="" |
|
2902 | 61 |
BATCH="" |
7889 | 62 |
TARGETS="" |
2755 | 63 |
|
15844 | 64 |
while getopts "abim:t" OPT |
2879 | 65 |
do |
66 |
case "$OPT" in |
|
67 |
a) |
|
68 |
ALL=true |
|
69 |
;; |
|
2902 | 70 |
b) |
71 |
BATCH=true |
|
72 |
;; |
|
6256 | 73 |
i) |
7889 | 74 |
TARGETS="$TARGETS images" |
75 |
;; |
|
76 |
m) |
|
77 |
TARGETS="$TARGETS $OPTARG" |
|
6256 | 78 |
;; |
2918 | 79 |
t) |
7889 | 80 |
TARGETS="$TARGETS test" |
2918 | 81 |
;; |
2879 | 82 |
\?) |
83 |
usage |
|
84 |
;; |
|
85 |
esac |
|
86 |
done |
|
87 |
||
88 |
shift $(($OPTIND - 1)) |
|
89 |
||
90 |
||
91 |
# args |
|
92 |
||
93 |
LOGICS="$@" |
|
94 |
||
4457 | 95 |
[ -n "$ALL" ] && LOGICS="$LOGICS $ALL_LOGICS" |
96 |
[ -z "$LOGICS" ] && LOGICS="$ISABELLE_LOGIC" |
|
97 |
||
2879 | 98 |
|
99 |
## main |
|
100 |
||
101 |
# tell the user about current values |
|
102 |
||
2902 | 103 |
if [ -z "$BATCH" ]; then |
104 |
echo |
|
105 |
echo " *****************************" |
|
106 |
echo " * Welcome to Isabelle build *" |
|
107 |
echo " *****************************" |
|
108 |
echo |
|
109 |
echo "Please check $ISABELLE_HOME/etc/settings" |
|
9789 | 110 |
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && echo "AND $ISABELLE_HOME_USER/etc/settings" |
5386 | 111 |
echo "to make sure that Isabelle's ML system settings and compilation options" |
112 |
echo "are appropriate." |
|
2902 | 113 |
echo |
5386 | 114 |
echo "The current values are:" |
2902 | 115 |
echo |
116 |
echo " ML_SYSTEM=$ML_SYSTEM" |
|
117 |
echo " ML_HOME=$ML_HOME" |
|
118 |
echo " ML_OPTIONS=$ML_OPTIONS" |
|
7277 | 119 |
echo " ML_PLATFORM=$ML_PLATFORM" |
5386 | 120 |
echo |
121 |
echo " ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS" |
|
17576 | 122 |
echo " HOL_USEDIR_OPTIONS=$HOL_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" |
17649 | 165 |
echo "HOL_USEDIR_OPTIONS=$HOL_USEDIR_OPTIONS" |
5393 | 166 |
echo |
2902 | 167 |
fi |
2755 | 168 |
|
169 |
||
2879 | 170 |
# build it |
171 |
||
10511 | 172 |
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
|
173 |
. "$ISABELLE_HOME/lib/scripts/timestart.bash" |
2914 | 174 |
|
4457 | 175 |
for L in $MAKE_LOGICS |
2755 | 176 |
do |
28500 | 177 |
( cd "$ISABELLE_HOME/src/$L"; "$ISABELLE_TOOL" make $TARGETS ) |
2755 | 178 |
done |
2902 | 179 |
|
2914 | 180 |
echo -n "Finished at "; date |
4457 | 181 |
|
18321
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
17649
diff
changeset
|
182 |
. "$ISABELLE_HOME/lib/scripts/timestop.bash" |
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
17649
diff
changeset
|
183 |
echo "$TIMES_REPORT" |