forked from WebAssembly/spec
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (76 loc) · 2.07 KB
/
Makefile
File metadata and controls
107 lines (76 loc) · 2.07 KB
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
# This Makefile uses dune but does not rely on ocamlfind or the Opam
# package manager to build. However, Opam package management is available
# optionally through the check/install/uninstall targets.
#
# The $(JSLIB).js target requires Js_of_ocaml (using ocamlfind).
#
# See README.me for instructions.
# Configuration
NAME = wasm
OPT = $(NAME).exe
ZIP = $(NAME).zip
JSLIB = wast.js
BUILDDIR = _build/default
JS = # set to JS shell command to run JS tests, empty to skip
# Main targets
.PHONY: default opt jslib all zip smallint
default: $(OPT)
jslib: $(JSLIB)
all: $(OPT) test
zip: $(ZIP)
smallint: smallint.exe
ci: all jslib
# Building executable
.PHONY: $(NAME).exe
$(NAME).exe:
rm -f $(NAME)
dune build $@
cp $(BUILDDIR)/$(OPT) $(NAME)
.PHONY: smallint.exe
smallint.exe:
dune build $@
# Building JavaScript library
$(JSLIB): $(BUILDDIR)/$(JSLIB)
cp $< $@
$(BUILDDIR)/$(JSLIB):
dune build $(JSLIB)
# Executing test suite
TESTDIR = ../test/core
# Skip _output directory, since that's a tmp directory, and list all other wast files.
TESTFILES = $(shell cd $(TESTDIR); ls *.wast; ls [a-z]*/*.wast)
TESTS = $(TESTFILES:%.wast=%)
.PHONY: test partest dune-test
test: $(OPT) smallint
$(TESTDIR)/run.py --wasm `pwd`/$(BUILDDIR)/$(OPT) $(if $(JS),--js '$(JS)',)
dune exec ./smallint.exe
test/%: $(OPT)
$(TESTDIR)/run.py --wasm `pwd`/$(BUILDDIR)/$(OPT) $(if $(JS),--js '$(JS)',) $(TESTDIR)/$*.wast
run/%: $(OPT)
./$(OPT) $(TESTDIR)/$*.wast
partest: $(TESTS:%=quiettest/%)
@echo All tests passed.
quiettest/%: $(OPT)
@ ( \
$(TESTDIR)/run.py 2>$(@F).out --wasm `pwd`/$(BUILDDIR)/$(OPT) $(if $(JS),--js '$(JS)',) $(TESTDIR)/$*.wast && \
rm $(@F).out \
) || \
cat $(@F).out || rm $(@F).out || exit 1
smallinttest: smallint
dune exec ./smallint.exe
dunetest:
dune test
install:
dune build -p $(NAME) @install
dune install
opam-release/%:
git tag opam-$*
git push --tags
opam publish
# Miscellaneous targets
.PHONY: clean
$(ZIP):
git archive --format=zip --prefix=$(NAME)/ -o $@ HEAD
clean:
dune clean
distclean: clean
rm -f $(NAME) $(JSLIB)