This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
51 lines (37 loc) · 1.79 KB
/
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
48
49
50
BENCHMARK=c10m
# WASI SDK C/C++ compiler
WASICC=wasi-sdk-20.0/bin/clang
WASICC_FLAGS=-O3
# Asyncify compiler from WABT
WASM_OPT=wasm-opt
ASYNCIFY=$(WASM_OPT) -O2 --asyncify --pass-arg=asyncify-ignore-imports
# Wasmtime engine
WASMTIME=wasmtime
WASMTIMEC=$(WASMTIME) compile
# WasmFX enabled Wasmtime engine
WASMTIMEFX_FLAGS=--wasm-features=exceptions,function-references,typed-continuations
WASMFXTIMEC=$(WASMTIMEC) $(WASMTIMEFX_FLAGS)
# WasmFX reference interpreter
WASM_INTERP=wasm
.PHONY: all
all: $(BENCHMARK)_bespoke.cwasm $(BENCHMARK)_asyncify.cwasm $(BENCHMARK)_wasmfx.cwasm
$(BENCHMARK)_bespoke.wasm: $(BENCHMARK)_bespoke.c
$(WASICC) $(WASICC_FLAGS) -o $(BENCHMARK)_bespoke.wasm $(BENCHMARK)_bespoke.c
$(BENCHMARK)_bespoke.cwasm: $(BENCHMARK)_bespoke.wasm
$(WASMTIMEC) -o $(BENCHMARK)_bespoke.cwasm $(BENCHMARK)_bespoke.wasm
$(BENCHMARK)_asyncify.wasm: $(BENCHMARK).c asyncify.c
$(WASICC) $(WASICC_FLAGS) -I . -o $(BENCHMARK)_asyncify.pre.wasm fiber_asyncify.c asyncify.c $(BENCHMARK).c
$(ASYNCIFY) $(BENCHMARK)_asyncify.pre.wasm -o $(BENCHMARK)_asyncify.wasm
$(BENCHMARK)_asyncify.cwasm: $(BENCHMARK)_asyncify.wasm
$(WASMTIMEC) -o $(BENCHMARK)_asyncify.cwasm $(BENCHMARK)_asyncify.wasm
## TODO(dhil): Currently $(BENCHMARK)_wasmfx.wast is assembled by hand. We
## should have a tool do the assembling.
$(BENCHMARK)_wasmfx.wasm: $(BENCHMARK)_wasmfx.wast
$(WASM_INTERP) -d -i $(BENCHMARK)_wasmfx.wast -o $(BENCHMARK)_wasmfx.wasm
chmod +x $(BENCHMARK)_wasmfx.wasm
$(BENCHMARK)_wasmfx.cwasm: $(BENCHMARK)_wasmfx.wasm
$(WASMFXTIMEC) -o $(BENCHMARK)_wasmfx.cwasm $(BENCHMARK)_wasmfx.wasm
.PHONY: clean
clean:
rm -f $(BENCHMARK)_asyncify.pre.wasm $(BENCHMARK)_asyncify.wasm $(BENCHMARK)_bespoke.wasm $(BENCHMARK)_wasmfx.wasm
rm -f $(BENCHMARK)_asyncify.cwasm $(BENCHMARK)_bespoke.cwasm $(BENCHMARK)_wasmfx.cwasm