forked from reklatsmasters/webassembly-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (40 loc) · 791 Bytes
/
Makefile
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
WAST2JS=wast2js
WAST2WASM=wast2wasm
CLANG=clang
LLC=llc
S2WASM=s2wasm
WASMOPT=wasm-opt
%.wasm : %.wat
$(WAST2WASM) $< -o $@
%.js : %.wat
$(WAST2JS) $< >$@
%.wat : %.s
$(S2WASM) $< > $@
$(WASMOPT) $@ \
-Oz \
--coalesce-locals-learning \
--dce \
--duplicate-function-elimination \
--inlining-optimizing \
--local-cse \
--merge-blocks \
--optimize-instructions \
--reorder-functions \
--reorder-locals \
--vacuum \
--emit-text \
-o $@
%.s : %.bc
$(LLC) $< \
-march=wasm32 \
-filetype=asm \
-asm-verbose=false \
-thread-model=single \
-data-sections \
-function-sections \
-o $@
%.bc : %.c
$(CLANG) --target=wasm32 -emit-llvm -Oz -c -nostdinc -nostdlib $< -o $@
all: native.js
clean:
rm -f native.s native.bc native.js native.wat native.wasm