-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile.in
307 lines (244 loc) · 10.7 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# The following licensing terms and conditions apply and must be
# accepted in order to use the Reference Implementation:
#
# 1. This Reference Implementation is made available to all
# interested persons on the same terms as Ecma makes available its
# standards and technical reports, as set forth at
# http://www.ecma-international.org/publications/.
#
# 2. All liability and responsibility for any use of this Reference
# Implementation rests with the user, and not with any of the parties
# who contribute to, or who own or hold any copyright in, this Reference
# Implementation.
#
# 3. THIS REFERENCE IMPLEMENTATION IS PROVIDED BY THE COPYRIGHT
# HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# End of Terms and Conditions
#
# Copyright (c) 2007 Adobe Systems Inc., The Mozilla Foundation, Opera
# Software ASA, and others.
# ------------------------------------------------------------------------------
# SML dialect
# ------------------------------------------------------------------------------
DIALECT:=@ES4_SML_DIALECT@
DEBUG:=@ES4_DEBUG@
# Location of SML/NJ tools (even if we're building with MLton)
SMLNJ:=@ES4_SMLNJ@
MLBUILD:=@ES4_MLBUILD@
HEAP2EXEC:=@ES4_HEAP2EXEC@
HEAP_SUFFIX:=@ES4_HEAP_SUFFIX@
SMLNJ_TDP:=@ES4_SMLNJ_TDP@
# Unfortunately the TDP traces slow down the code significantly.
ifneq ($(DEBUG),no)
ifneq ($(SMLNJ_TDP),)
MLBUILD_ARGS:=-Ctdp.instrument=true -DBACKTRACE \$$smlnj-tdp/back-trace.cm
endif
endif
# Standard ML of New Jersey
ifeq ($(DIALECT),smlnj)
DUMP:=es4.image.$(HEAP_SUFFIX)
RUN:=$(SMLNJ) @SMLload=es4-init.heap.$(HEAP_SUFFIX)
RUN_DUMPED:=$(SMLNJ) @SMLload=$(DUMP)
# MLton
else
MLTON:=@ES4_MLTON@
# ML-editline configuration
ifeq ($(shell uname | sed -e 's/MINGW.*/MINGW/'),MINGW)
TERMINAL_ARCH=win32
LIB_TERMINAL=terminal.dll terminal.def
MLTON_LINK_OPT=terminal.def
else
TERMINAL_ARCH=unix
LIB_TERMINAL=libterminal.a
MLTON_LINK_OPT=-lcurses
endif
EDITLINE_HOME=./ml-editline
TERMINAL_HOME=$(EDITLINE_HOME)/terminal
TERMINAL_SOURCES=$(TERMINAL_HOME)/*.mlb $(TERMINAL_HOME)/*.sig $(TERMINAL_HOME)/*.sml
EDITLINE_SOURCES=$(EDITLINE_HOME)/*.mlb $(EDITLINE_HOME)/*.sig $(EDITLINE_HOME)/*.sml
ifneq ($(DEBUG),no)
MLTONOPTS:=-const 'Exn.keepHistory true'
endif
MLTONCC:=-cc-opt -Idecimal/decNumber
EXE:=es4@EXEEXT@
DUMP:=es4.image
RUN:=./$(EXE)
RUN_DUMPED:=./$(EXE) @MLton load-world $(DUMP) --
endif
# ------------------------------------------------------------------------------
# File listings
# ------------------------------------------------------------------------------
SOURCES:=ast.sml boot.sml decimal-params.sml decimal.sml defn.sml eval.sml \
logerr.sml mach.sml main.sml multiname.sml name.sml native.sml \
lexer.sml parser.sml pretty-rep.sml pretty.sml profile.sml token.sml \
ustring.sml verify.sml type.sml fixture.sml fixture.sig
ifeq ($(DIALECT),smlnj)
SOURCES += decimal-external.sml smlnj.sml
else
SOURCES += decimal-mlton.sml mlton.sml
endif
DECIMAL_SOURCES:=decimal/decimal-ffi.c decimal/decNumber/decNumber.c \
decimal/decNumber/decContext.c decimal/decNumber/decimal128.c \
decimal/decNumber/decimal64.c decimal/decNumber/decimal32.c
EV_TESTS := tests/exec.es
# ------------------------------------------------------------------------------
# Targets
# ------------------------------------------------------------------------------
.PHONY: compile check checktc checkev checklth dump wc clean profile decimal dist
# ------------------------------------------------------------------------------
# SML/NJ targets
# ------------------------------------------------------------------------------
ifeq ($(DIALECT),smlnj)
compile: es4-init.heap.$(HEAP_SUFFIX)
# TODO: "check" should do all the *.test files, not just parse tests
check: tools/unit.heap.$(HEAP_SUFFIX) es4-init.heap.$(HEAP_SUFFIX)
$(SMLNJ) @SMLload=tools/unit.heap $(TRACE) tests/parse.test
checktc: tools/unit.heap.$(HEAP_SUFFIX) es4-init.heap.$(HEAP_SUFFIX)
$(SMLNJ) @SMLload=tools/unit.heap $(TRACE) tests/tc.test
checkev: tools/unit.heap.$(HEAP_SUFFIX) es4-init.heap.$(HEAP_SUFFIX)
$(SMLNJ) @SMLload=tools/unit.heap $(TRACE) tests/exec/exec.test
checklth: tools/unit.heap.$(HEAP_SUFFIX) es4-init.heap.$(HEAP_SUFFIX)
$(SMLNJ) @SMLload=tools/unit.heap $(TRACE) tests/lth_tests/lth_tests.test
repl: $(DUMP)
perl bin/repl-with-readline.pl
replNoReadline: $(DUMP)
$(RUN_DUMPED) -r
profile:
touch multiname.sml mach.sml eval.sml
$(SMLNJ) -Ctdp.instrument=true profile.sml 2>&1 | tee profile.txt
decimal:
cd decimal && $(MAKE) decimal && cp decimal ../bin/
es4-init.heap.$(HEAP_SUFFIX): $(wildcard *.sml) pretty-cvt.sml version.sml Makefile
$(MLBUILD) $(MLBUILD_ARGS) es4.cm SMLofNJEntry.main es4-init.heap
$(DUMP): es4-init.heap.$(HEAP_SUFFIX) $(wildcard builtins/*.es)
$(SMLNJ) @SMLload=es4-init.heap -dump
dist/es4.tar.gz: dump decimal clean-dist
cp bin/decimal dist/es4/
cp $(DUMP) dist/es4/es4.image.$(HEAP_SUFFIX)
ifeq ($(HEAP2EXEC),false)
cp bin/run-cygwin.sh dist/es4/es4
else
cp bin/run-smlnj.sh dist/es4/es4
$(HEAP2EXEC) $(DUMP) dist/es4/run
endif
# ------------------------------------------------------------------------------
# MLton targets
# ------------------------------------------------------------------------------
else
compile: $(EXE)
libterminal.a:
cd $(TERMINAL_HOME)/unix && $(MAKE) libterminal.a
cp $(TERMINAL_HOME)/unix/libterminal.a ./libterminal.a
terminal.dll:
cp $(TERMINAL_HOME)/win32/Release/terminal.dll ./terminal.dll
terminal.def:
cp $(TERMINAL_HOME)/win32/Release/terminal.def ./terminal.def
$(EXE): es4.mlb $(SOURCES) $(EDITLINE_SOURCSE) $(TERMINAL_SOURCES) $(DECIMAL_SOURCES) $(LIB_TERMINAL) version.sml Makefile
echo TERMINAL_ARCH $(TERMINAL_ARCH) > mlb-path-map
$(MLTON) $(MLTONOPTS) -mlb-path-map mlb-path-map -link-opt -L./ -link-opt -lterminal -link-opt $(MLTON_LINK_OPT) $(MLTONCC) es4.mlb $(DECIMAL_SOURCES)
cp $(EDITLINE_HOME)/*.dll ./
$(DUMP): $(EXE)
./$(EXE) -dump
dist/es4.tar.gz: dump clean-dist
cp $(EXE) dist/es4/run.exe
cp $(DUMP) dist/es4/
cp bin/es4.bat dist/es4/
(which libgmp-3.dll >/dev/null 2>&1 && cp `which libgmp-3.dll` dist/es4/) || true
(test -e ./terminal.dll && cp ./terminal.dll dist/es4/) || true
cp bin/run-mlton.sh dist/es4/es4
endif
# ------------------------------------------------------------------------------
# Common targets
# ------------------------------------------------------------------------------
smoketest: $(DUMP)
$(RUN_DUMPED) -e $(TRACE) tests/spidermonkey/ecma/shell.js tests/spidermonkey/ecma/Array/15.4.2.2-2.js
$(RUN_DUMPED) -e $(TRACE) tests/spidermonkey/ecma/shell.js tests/spidermonkey/ecma/Boolean/15.6.1.js
$(RUN_DUMPED) -e $(TRACE) tests/spidermonkey/ecma/shell.js tests/spidermonkey/ecma/Date/15.9.2.2-6.js
$(RUN_DUMPED) -e $(TRACE) tests/spidermonkey/ecma/shell.js tests/spidermonkey/ecma/LexicalConventions/7.6.js
$(RUN_DUMPED) -e $(TRACE) tests/spidermonkey/ecma/shell.js tests/spidermonkey/ecma/Statements/12.6.3-4.js
$(RUN_DUMPED) -e $(TRACE) tests/spidermonkey/ecma/shell.js tests/spidermonkey/ecma/TypeConversion/9.3.js
# Spidermonkey test support
SM_CWD:=$(PWD)
SM_REL=$(patsubst $(SM_CWD)/%,%,$(1))
SM_CMD=$(call SM_REL,$(RUN_DUMPED) -3 -e tests/spidermonkey/ecma/shell.js $(realpath $(dir $(1))../shell.js $(dir $(1))shell.js) $(1))
SM_TARGET_DIR=tests/spidermonkey/ecma*/*/*.js
SPIDERMONKEY_TESTS:=$(call SM_REL,$(sort $(filter-out %/shell.js, $(wildcard $(SM_TARGET_DIR)))))
SPIDERMONKEY_OUTPUTS:=$(patsubst %.js,%.sm-out,$(SPIDERMONKEY_TESTS))
SPIDERMONKEY_LOG=spidermonkey-test.log
$(SPIDERMONKEY_LOG): $(SPIDERMONKEY_OUTPUTS)
@echo collecting logs into $@
@cat $^ >$@
%.sm-out: %.js $(DUMP) Makefile
@echo "checking $< > $@"
@echo $(call SM_CMD,$<) >$@
@$(call SM_CMD,$<) >>$@ 2>&1 || true
checksm: $(SPIDERMONKEY_LOG)
perl analyze-spidermonkey-log.pl $<
cleansm:
@for i in $(wildcard $(SPIDERMONKEY_OUTPUTS) $(SPIDERMONKEY_LOG)); \
do echo rm $$i; \
rm $$i; \
done
# Obsolete now?
run:
$(RUN) -e $(TRACE) $(FILE)
# Do *not* give this dependencies to see if the heap is up-to-date.
run-dumped:
$(RUN_DUMPED) -e $(TRACE) $(FILE)
wc:
wc $(SOURCES)
clean:
rm -rf .cm tools/.cm es4-init.heap.$(HEAP_SUFFIX) \
tools/gen-pretty.heap.$(HEAP_SUFFIX) \
tools/gen-english.heap.$(HEAP_SUFFIX) \
$(EXE) $(DUMP)
dump: $(DUMP)
clean-dist:
rm -rf dist/es4 dist/es4.tar dist/es4.tar.gz
mkdir -p dist/es4
mkdir -p dist/es4/builtins
dist: dist/es4.tar.gz
chmod -R u=rwx,go=rx dist/es4
cp README INSTALL LICENSE dist/es4
cp bin/LGPL.txt dist/es4/LICENSE.GNUMP
cp bin/ICUL.txt dist/es4/LICENSE.DECIMAL
cp unicode/Copyright.txt dist/es4/LICENSE.UNICODE
chmod 644 dist/es4/README dist/es4/INSTALL dist/es4/LICENSE dist/es4/LICENSE.GNUMP dist/es4/LICENSE.DECIMAL dist/es4/LICENSE.UNICODE
cp builtins/*.es dist/es4/builtins/
cd dist && tar cf es4.tar es4
gzip -v9 dist/es4.tar
version.sml: VERSION TITLE version.template
sed -e "s/%TITLE%/`cat TITLE`/" -e "s/%VERSION%/`cat VERSION`/" version.template > version.sml
pretty-cvt.sml: tools/gen-pretty.heap.$(HEAP_SUFFIX) ast.sml
$(SMLNJ) @SMLload=tools/gen-pretty.heap ast.sml pretty-cvt.sml
tools/gen-pretty.heap.$(HEAP_SUFFIX): tools/gen-pretty.cm tools/gen-convert.sml tools/gen-pretty.sml tools/quasiquote.sml tools/smlast.sml
$(MLBUILD) $(MLBUILD_ARGS) $< GenPretty.main $@
tools/gen-english.heap.$(HEAP_SUFFIX): tools/gen-english.cm tools/gen-english.sml tools/smlast.sml
$(MLBUILD) $(MLBUILD_ARGS) $< GenEnglish.main $@
tools/gen-cg.heap.$(HEAP_SUFFIX): tools/gen-cg.cm tools/gen-cg.sml tools/smlast.sml
$(MLBUILD) $(MLBUILD_ARGS) $< GenCG.main $@
%.cg: tools/gen-cg.heap.$(HEAP_SUFFIX)
$(SMLNJ) @SMLload=tools/gen-cg.heap $*.sml | tee $@
english/eval-%.html: eval.sml tools/gen-english.heap.$(HEAP_SUFFIX)
$(SMLNJ) @SMLload=tools/gen-english.heap $< $* $@
tools/unit.heap.$(HEAP_SUFFIX): tools/unit.cm tools/unit.sml $(wildcard *.sml) pretty-cvt.sml
$(MLBUILD) $(MLBUILD_ARGS) $< UnitTests.main $@
# Automatically regenerate the configure and Makefile files when necessary.
# http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_chapter/autoconf_4.html#SEC26
configure: configure.ac
autoconf
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck