SCM Repository
Annotation of /sml/trunk/src/compiler/buildcm
Parent Directory
|
Revision Log
Revision 83 - (view) (download)
1 : | monnier | 16 | #!/bin/sh |
2 : | # | ||
3 : | # build: build script for CM bootstrapping | ||
4 : | # | ||
5 : | # Copyright (c) 1995 by AT&T Bell Laboratories | ||
6 : | # | ||
7 : | # author: Matthias Blume (blume@cs.princeton.edu) | ||
8 : | # | ||
9 : | # options: | ||
10 : | # -o image -- specify the name of the heap image, "sml-cm.ARCH" | ||
11 : | # is the default. | ||
12 : | # -sml path -- specify the path to the sml executable, "../bin/sml" | ||
13 : | # is the default. | ||
14 : | # -yacc path -- defines the name of the ml-yacc command, "ml-yacc" | ||
15 : | # is the default. | ||
16 : | # -lex path -- defines the name of the ml-lex command, "ml-lex" | ||
17 : | # is the default. | ||
18 : | # -burg path -- defines the name of the ml-burg command, "ml-burg" | ||
19 : | # is the default. | ||
20 : | # -rcs path -- defines the name of the RCS check-out command, | ||
21 : | # "co -q" is the default | ||
22 : | # -L path-list -- specify a colon separated search path list for | ||
23 : | # libraries. | ||
24 : | # | ||
25 : | |||
26 : | tmp=load-all-`hostname`-$$ | ||
27 : | config=config-`hostname`-$$.sml | ||
28 : | |||
29 : | trap "rm -f $config $tmp; exit 1" 1 2 3 15 | ||
30 : | |||
31 : | CMD="buildcm" | ||
32 : | |||
33 : | |||
34 : | ROOT="sml-cm" | ||
35 : | HEAP_IMAGE="" | ||
36 : | SML="./xrun" | ||
37 : | # SML="../../bin/sml" | ||
38 : | |||
39 : | YACC="ml-yacc" | ||
40 : | LEX="ml-lex" | ||
41 : | BURG="ml-burg" | ||
42 : | RCSCO="co -q" | ||
43 : | NLL="false" | ||
44 : | BIN="../../bin" | ||
45 : | CMPATH="" | ||
46 : | PROF="" | ||
47 : | CHECK="" | ||
48 : | league | 52 | STATS="" |
49 : | monnier | 16 | CURDIR=`pwd` |
50 : | cd ../cm/ | ||
51 : | |||
52 : | # | ||
53 : | # process command-line options | ||
54 : | # | ||
55 : | ARGS="" | ||
56 : | while [ "$#" != "0" ] | ||
57 : | do | ||
58 : | arg=$1 | ||
59 : | shift | ||
60 : | case $arg in | ||
61 : | -yacc) | ||
62 : | if [ "$#" = "0" ]; then | ||
63 : | echo "$CMD: must supply name of ML-Yacc for -yacc option" | ||
64 : | exit 1 | ||
65 : | fi | ||
66 : | YACC=$1; shift | ||
67 : | ;; | ||
68 : | -lex) | ||
69 : | if [ "$#" = "0" ]; then | ||
70 : | echo "$CMD: must supply name of ML-Lex for -lex option" | ||
71 : | exit 1 | ||
72 : | fi | ||
73 : | LEX=$1; shift | ||
74 : | ;; | ||
75 : | -burg) | ||
76 : | if [ "$#" = "0" ]; then | ||
77 : | echo "$CMD: must supply name of ML-Burg for -burg option" | ||
78 : | exit 1 | ||
79 : | fi | ||
80 : | BURG=$1; shift | ||
81 : | ;; | ||
82 : | -rcs) | ||
83 : | if [ "$#" = "0" ]; then | ||
84 : | echo "$CMD: must supply RCS check-out command for -rcs option" | ||
85 : | exit 1 | ||
86 : | fi | ||
87 : | RCSCO=$1; shift | ||
88 : | ;; | ||
89 : | -L) | ||
90 : | if [ "$#" = "0" ]; then | ||
91 : | echo "$CMD: must supply path spec for -L option" | ||
92 : | exit 1 | ||
93 : | fi | ||
94 : | CMPATH=$1; shift | ||
95 : | ;; | ||
96 : | -nll) | ||
97 : | NLL="true" | ||
98 : | ;; | ||
99 : | -bin) | ||
100 : | if [ "$#" = "0" ]; then | ||
101 : | echo "$CMD: must supply bin directory path for -bin option" | ||
102 : | exit 1 | ||
103 : | fi | ||
104 : | BIN=$1; shift | ||
105 : | ;; | ||
106 : | -o) | ||
107 : | if [ "$#" = "0" ]; then | ||
108 : | echo "$CMD: must supply image name for -o option" | ||
109 : | exit 1 | ||
110 : | fi | ||
111 : | HEAP_IMAGE=$1; shift | ||
112 : | ;; | ||
113 : | -sml) | ||
114 : | if [ "$#" = "0" ]; then | ||
115 : | echo "$CMD: must supply path for -sml option" | ||
116 : | exit 1 | ||
117 : | fi | ||
118 : | SML=$1; shift | ||
119 : | ;; | ||
120 : | league | 52 | -note) |
121 : | if [ "$#" = "0" ]; then | ||
122 : | echo "xmakeml: missing argument for \"-note\" option" | ||
123 : | exit 1 | ||
124 : | fi | ||
125 : | NOTE="$1\n"; shift | ||
126 : | ;; | ||
127 : | -full) | ||
128 : | ARGS="$ARGS sml-full" | ||
129 : | NOTE="[-full]\n$NOTE" | ||
130 : | HEAP_IMAGE="sml-cm-full" | ||
131 : | ;; | ||
132 : | monnier | 16 | -prof) |
133 : | PROF="local open Compiler.Profile in val _ = setMode ACTIVE end;" | ||
134 : | ;; | ||
135 : | -early-check) | ||
136 : | CHECK='use "sys/compiler.sig"; | ||
137 : | functor CheckIt (C: COMPILER) = C; | ||
138 : | structure CheckItOut = CheckIt (Compiler);' | ||
139 : | ;; | ||
140 : | -stats) | ||
141 : | league | 52 | STATS='Compiler.Stats.summary ();' |
142 : | monnier | 16 | ;; |
143 : | *) | ||
144 : | ARGS="$ARGS $arg" | ||
145 : | ;; | ||
146 : | esac | ||
147 : | done | ||
148 : | |||
149 : | # | ||
150 : | # split the pathname and build SML string list | ||
151 : | # | ||
152 : | league | 52 | if [ "$ARGS" = "" ]; then |
153 : | ARGS="sml" | ||
154 : | fi | ||
155 : | monnier | 16 | |
156 : | SPACEPATH=`echo $CMPATH | sed -e 's/:/ /g'` | ||
157 : | PATHLIST="" | ||
158 : | for i in $SPACEPATH | ||
159 : | do | ||
160 : | PATHLIST="$PATHLIST \"$i\" :: " | ||
161 : | done | ||
162 : | PATHLIST="$PATHLIST []" | ||
163 : | |||
164 : | # | ||
165 : | # generate the config.sml file, with the proper yacc and lex paths, etc. | ||
166 : | # | ||
167 : | |||
168 : | cat - > $config <<XXXX | ||
169 : | (* config.sml --- generated by _build_ script *) | ||
170 : | |||
171 : | structure CmConfig = struct | ||
172 : | val lex = "$LEX" | ||
173 : | val yacc = "$YACC" | ||
174 : | val burg = "$BURG" | ||
175 : | val namelength_limited = $NLL | ||
176 : | val path: string list = $PATHLIST | ||
177 : | val rcsco = "$RCSCO" | ||
178 : | end | ||
179 : | XXXX | ||
180 : | |||
181 : | sed -e "s|config/config.sml|${config}|" <load-all >$tmp | ||
182 : | |||
183 : | if [ "$HEAP_IMAGE" = "" ]; then | ||
184 : | HEAP_IMAGE="$ROOT" | ||
185 : | fi | ||
186 : | |||
187 : | cd $CURDIR | ||
188 : | |||
189 : | $SML $ARGS <<ZZZ | ||
190 : | $PROF | ||
191 : | $CHECK | ||
192 : | val _ = Posix.FileSys.chdir "../cm/"; | ||
193 : | use "$tmp"; | ||
194 : | $STATS | ||
195 : | league | 52 | Compiler.Stats.summary(); |
196 : | monnier | 16 | val _ = Posix.FileSys.chdir "$CURDIR"; |
197 : | (SMLofNJ.exportML "$HEAP_IMAGE"; | ||
198 : | league | 52 | print (Compiler.banner ^ |
199 : | "\n[built `date`]\n$NOTE[CM&CMB]\n"); | ||
200 : | league | 83 | CM.procCmdLine ()); |
201 : | monnier | 16 | ZZZ |
202 : | monnier | 57 | |
203 : | monnier | 16 | rm -f ../cm/$config ../cm/$tmp |
204 : | exit 0 |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |