author | quigley |
Wed, 20 Apr 2005 16:03:17 +0200 | |
changeset 15779 | aed221aff642 |
parent 14981 | e73f8140af78 |
child 15790 | e68dab670fc5 |
permissions | -rwxr-xr-x |
11391 | 1 |
#!/usr/bin/env bash |
2339 | 2 |
# |
3 |
# $Id$ |
|
9789 | 4 |
# Author: Markus Wenzel, TU Muenchen |
2339 | 5 |
# |
6 |
# mk - build Pure Isabelle. |
|
7 |
# |
|
10102 | 8 |
# Requires proper Isabelle settings environment (cf. IsaMakefile). |
2339 | 9 |
|
10 |
||
11 |
## diagnostics |
|
12 |
||
3774 | 13 |
function usage() |
14 |
{ |
|
15 |
echo |
|
16 |
echo "Usage: $PRG [OPTIONS]" |
|
17 |
echo |
|
18 |
echo " Make Pure Isabelle." |
|
19 |
echo |
|
10102 | 20 |
echo " -C tell ML system to copy output image" |
21 |
echo " -r prepare RAW image only" |
|
3774 | 22 |
echo |
23 |
exit 1 |
|
24 |
} |
|
25 |
||
2339 | 26 |
function fail() |
27 |
{ |
|
28 |
echo "$1" >&2 |
|
29 |
exit 2 |
|
30 |
} |
|
31 |
||
32 |
||
3774 | 33 |
## process command line |
34 |
||
35 |
# options |
|
36 |
||
10102 | 37 |
COPY="" |
3774 | 38 |
RAW="" |
39 |
||
10102 | 40 |
while getopts "Cr" OPT |
3774 | 41 |
do |
42 |
case "$OPT" in |
|
10102 | 43 |
C) |
44 |
COPY="-C" |
|
45 |
;; |
|
3774 | 46 |
r) |
47 |
RAW=true |
|
48 |
;; |
|
49 |
\?) |
|
50 |
usage |
|
51 |
;; |
|
52 |
esac |
|
53 |
done |
|
54 |
||
55 |
shift $(($OPTIND - 1)) |
|
56 |
||
57 |
||
58 |
# args |
|
59 |
||
9789 | 60 |
[ "$#" -ne 0 ] && usage |
3774 | 61 |
|
62 |
||
2339 | 63 |
## main |
64 |
||
4442 | 65 |
# get compatibility file |
66 |
||
9789 | 67 |
ML_SYSTEM_BASE=$(echo "$ML_SYSTEM" | cut -f1 -d-) |
3056 | 68 |
[ -z "$ML_SYSTEM" ] && \ |
6186 | 69 |
fail "Missing ML system settings! Probably not run via 'isatool make'." |
2339 | 70 |
|
71 |
COMPAT="" |
|
72 |
[ -f "ML-Systems/$ML_SYSTEM_BASE.ML" ] && COMPAT="ML-Systems/$ML_SYSTEM_BASE.ML" |
|
73 |
[ -f "ML-Systems/$ML_SYSTEM.ML" ] && COMPAT="ML-Systems/$ML_SYSTEM.ML" |
|
74 |
[ -z "$COMPAT" ] && fail "Missing compatibility file for ML system \"$ML_SYSTEM\"!" |
|
75 |
||
4442 | 76 |
|
77 |
# prepare log dir |
|
78 |
||
79 |
LOGDIR="$ISABELLE_OUTPUT/log" |
|
80 |
mkdir -p "$LOGDIR" |
|
81 |
||
82 |
||
83 |
# run isabelle |
|
84 |
||
85 |
SECONDS=0 |
|
86 |
||
3774 | 87 |
if [ -z "$RAW" ]; then |
4442 | 88 |
ITEM="Pure" |
7277 | 89 |
echo "Building $ITEM ..." |
15779
aed221aff642
Removed remaining references to Main.thy in reconstruction code.
quigley
parents:
14981
diff
changeset
|
90 |
|
aed221aff642
Removed remaining references to Main.thy in reconstruction code.
quigley
parents:
14981
diff
changeset
|
91 |
echo "raw is $RAW item is $ITEM isabelle is $ISABELLE" |
aed221aff642
Removed remaining references to Main.thy in reconstruction code.
quigley
parents:
14981
diff
changeset
|
92 |
|
4442 | 93 |
LOG="$LOGDIR/$ITEM" |
94 |
||
10102 | 95 |
"$ISABELLE" $COPY \ |
3774 | 96 |
-e "val ml_system = \"$ML_SYSTEM\";" \ |
4495 | 97 |
-e "(use\"$COMPAT\"; use\"ROOT.ML\") handle _ => exit 1;" \ |
10900 | 98 |
-f -c -q -w RAW_ML_SYSTEM Pure > "$LOG" 2>&1 |
9789 | 99 |
RC="$?" |
3774 | 100 |
else |
4442 | 101 |
ITEM="RAW" |
7277 | 102 |
echo "Building $ITEM ..." |
4442 | 103 |
LOG="$LOGDIR/$ITEM" |
104 |
||
10102 | 105 |
"$ISABELLE" $COPY \ |
3774 | 106 |
-e "val ml_system = \"$ML_SYSTEM\";" \ |
10900 | 107 |
-e "use\"$COMPAT\" handle _ => exit 1;" \ |
9789 | 108 |
-q -w RAW_ML_SYSTEM RAW > "$LOG" 2>&1 |
109 |
RC="$?" |
|
3774 | 110 |
fi |
4442 | 111 |
|
9789 | 112 |
ELAPSED=$("$ISABELLE_HOME/lib/scripts/showtime" "$SECONDS") |
4442 | 113 |
|
114 |
||
115 |
# exit status |
|
116 |
||
9789 | 117 |
if [ "$RC" -eq 0 ]; then |
7277 | 118 |
echo "Finished $ITEM ($ELAPSED elapsed time)" |
4442 | 119 |
gzip --force "$LOG" |
120 |
else |
|
7263 | 121 |
echo "$ITEM FAILED" |
4442 | 122 |
echo "(see also $LOG)" |
9789 | 123 |
echo; tail "$LOG"; echo |
4442 | 124 |
fi |
125 |
||
9789 | 126 |
exit "$RC" |