Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/config/_ml-build
ViewVC logotype

Annotation of /sml/trunk/config/_ml-build

Parent Directory Parent Directory | Revision Log Revision Log


Revision 692 - (view) (download)

1 : blume 537 #!@SHELL@
2 :    
3 :     BIN_DIR=@BINDIR@
4 :    
5 :     SML=$BIN_DIR/sml
6 :     LINK=$BIN_DIR/.link-sml
7 :    
8 :     thisscript=$0
9 :    
10 :     xx=$$
11 :     smlfile=$xx-export.sml
12 :     cmfile=$xx-export.cm
13 :     listfile=$xx-BOOTLIST
14 : blume 692 mlscript=$xx-mlscript.sml
15 : blume 537
16 : blume 692 dulist=''
17 :    
18 : blume 569 trap 'rm -rf `find . -name $smlfile` $cmfile $listfile $mlscript' 0 1 2 3 15
19 : blume 537
20 :     usage() {
21 :     echo ${thisscript}: $*
22 :     echo Usage: $thisscript root-group main-function heapfile
23 :     exit 1
24 :     }
25 :    
26 : blume 692 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 : blume 537 if [ $# != 3 ] ; then
39 :     usage wrong number of arguments
40 :     fi
41 :    
42 :     root=$1
43 :     main=$2
44 :     heap=$3
45 :    
46 :     rare=XYZ_XXX_0123
47 :    
48 :     cat >$smlfile <<EOF
49 :     structure ${rare} = struct val _ = SMLofNJ.exportFn ("${heap}", ${main}) end
50 :     EOF
51 :    
52 :     cat >$cmfile <<EOF
53 : blume 644 Group structure ${rare} is \$/basis.cm ${root} ${smlfile}
54 : blume 537 EOF
55 :    
56 :     cat >$mlscript <<EOF
57 : blume 692 ignore (OS.Process.exit ((case CM.mk_standalone NONE
58 :     { 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 : blume 537 | SOME l => let val s = TextIO.openOut "${listfile}"
65 : blume 569 fun wr str = TextIO.output (s, str ^ "\n")
66 :     val n = length l
67 :     fun maxsz (s, n) = Int.max (size s, n)
68 :     val m = foldl maxsz 0 l
69 :     in wr (concat ["%", Int.toString n, " ", Int.toString m]);
70 :     app wr l;
71 : blume 537 TextIO.closeOut s;
72 : blume 692 OS.Process.system "${LINK} @SMLboot=${listfile}"
73 : blume 537 end)
74 : blume 569 handle _ => OS.Process.failure))
75 : blume 537 EOF
76 :    
77 : blume 652 # Provide $smlnj/cm.cm as a command-line argument just to be absolutely
78 :     # sure that structure CM is available. (Under normal circumstances it
79 :     # is already available -- even without any command line arguments.)
80 : blume 692 $SML '$smlnj/cm.cm' $dulist $mlscript
81 :    
82 :     exit $?

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0