11 |
smlfile=$xx-export.sml |
smlfile=$xx-export.sml |
12 |
cmfile=$xx-export.cm |
cmfile=$xx-export.cm |
13 |
listfile=$xx-BOOTLIST |
listfile=$xx-BOOTLIST |
14 |
mlscript=$xx-script |
mlscript=$xx-mlscript.sml |
15 |
|
|
16 |
|
dulist='' |
17 |
|
|
18 |
trap 'rm -rf `find . -name $smlfile` $cmfile $listfile $mlscript' 0 1 2 3 15 |
trap 'rm -rf `find . -name $smlfile` $cmfile $listfile $mlscript' 0 1 2 3 15 |
19 |
|
|
23 |
exit 1 |
exit 1 |
24 |
} |
} |
25 |
|
|
26 |
|
while [ $# != 0 ] ; do |
27 |
|
case $1 in |
28 |
|
-D*|-U*) |
29 |
|
dulist="$dulist $1" |
30 |
|
shift |
31 |
|
;; |
32 |
|
*) |
33 |
|
break |
34 |
|
;; |
35 |
|
esac |
36 |
|
done |
37 |
|
|
38 |
if [ $# != 3 ] ; then |
if [ $# != 3 ] ; then |
39 |
usage wrong number of arguments |
usage wrong number of arguments |
40 |
fi |
fi |
50 |
EOF |
EOF |
51 |
|
|
52 |
cat >$cmfile <<EOF |
cat >$cmfile <<EOF |
53 |
Group structure ${rare} is basis.cm ${root} ${smlfile} |
Group structure ${rare} is \$/basis.cm ${root} ${smlfile} |
54 |
EOF |
EOF |
55 |
|
|
56 |
cat >$mlscript <<EOF |
cat >$mlscript <<EOF |
57 |
ignore (OS.Process.exit ((case CM.mk_standalone NONE "${cmfile}" of |
ignore (OS.Process.exit ((case CM.mk_standalone NONE |
58 |
NONE => OS.Process.failure |
{ project = "${root}", |
59 |
|
wrapper = "${cmfile}", |
60 |
|
target = "$heap" } of |
61 |
|
NONE => (print "Compilation failed.\n"; OS.Process.failure) |
62 |
|
| SOME [] => (print "Heap was already up-to-date.\n"; |
63 |
|
OS.Process.success) |
64 |
| SOME l => let val s = TextIO.openOut "${listfile}" |
| SOME l => let val s = TextIO.openOut "${listfile}" |
65 |
fun wr str = TextIO.output (s, str ^ "\n") |
fun wr str = TextIO.output (s, str ^ "\n") |
66 |
val n = length l |
val n = length l |
69 |
in wr (concat ["%", Int.toString n, " ", Int.toString m]); |
in wr (concat ["%", Int.toString n, " ", Int.toString m]); |
70 |
app wr l; |
app wr l; |
71 |
TextIO.closeOut s; |
TextIO.closeOut s; |
72 |
OS.Process.success |
OS.Process.system "${LINK} @SMLboot=${listfile}" |
73 |
end) |
end) |
74 |
handle _ => OS.Process.failure)) |
handle _ => OS.Process.failure)) |
75 |
EOF |
EOF |
76 |
|
|
77 |
if $SML full-cm.cm <$mlscript ; then |
# Provide $smlnj/cm.cm as a command-line argument just to be absolutely |
78 |
$LINK @SMLboot=$listfile $ |
# sure that structure CM is available. (Under normal circumstances it |
79 |
else |
# is already available -- even without any command line arguments.) |
80 |
echo Compilation failed. |
$SML '$smlnj/cm.cm' $dulist $mlscript |
81 |
exit 1 |
|
82 |
fi |
exit $? |