|
|
|
@ -10,8 +10,6 @@ RUNTIME_CFILES+=${RUNTIME_PATH}/libc/env.c
|
|
|
|
|
RUNTIME_CFILES+=${RUNTIME_PATH}/memory/64bit_nix.c
|
|
|
|
|
|
|
|
|
|
WASMCEPTION_RUNTIME_CFILES=${RUNTIME_CFILES} ${RUNTIME_PATH}/libc/wasmception_backing.c
|
|
|
|
|
MINIMAL_CFILES=${RUNTIME_CFILES} ${RUNTIME_PATH}/libc/wasi_sdk_backing.c
|
|
|
|
|
MINIMAL_INCLUDES=-I../../runtime/libc/
|
|
|
|
|
|
|
|
|
|
.PHONY: wasm
|
|
|
|
|
wasm: $(patsubst %.wat, %.wasm, $(wildcard *.wat))
|
|
|
|
@ -22,6 +20,20 @@ bc: $(patsubst %.wat, %.bc, $(wildcard *.wat))
|
|
|
|
|
.PHONY: ll
|
|
|
|
|
ll: $(patsubst %.wat, %.ll, $(wildcard *.wat))
|
|
|
|
|
|
|
|
|
|
# Log all WASI syscalls and arguments to stderr
|
|
|
|
|
# RUNTIME_CFLAGS += -DLOG_WASI
|
|
|
|
|
|
|
|
|
|
# modules with WASI imports will fail on wasmception builds
|
|
|
|
|
# Only run this manually
|
|
|
|
|
# .PHONY: wasmception
|
|
|
|
|
# wasmception: $(patsubst %.wat, %_wasmception, $(wildcard *.wat))
|
|
|
|
|
|
|
|
|
|
.PHONY: uvwasi
|
|
|
|
|
uvwasi: $(patsubst %.wat, %_uvwasi, $(wildcard *.wat))
|
|
|
|
|
|
|
|
|
|
.PHONY: minimal
|
|
|
|
|
minimal: $(patsubst %.wat, %_minimal, $(wildcard *.wat))
|
|
|
|
|
|
|
|
|
|
.PHONY: install_wasmtime
|
|
|
|
|
install_wasmtime:
|
|
|
|
|
@curl https://wasmtime.dev/install.sh -sSf | bash
|
|
|
|
@ -51,8 +63,29 @@ clean:
|
|
|
|
|
%.wasmception.out: %.bc ${WASMCEPTION_RUNTIME_CFILES}
|
|
|
|
|
${CC} -lm ${OPTFLAGS} $^ -o $@
|
|
|
|
|
|
|
|
|
|
# Using minimal WASI-SDK backend
|
|
|
|
|
%.minimal.out: %.bc ${MINIMAL_CFILES}
|
|
|
|
|
# Using uvwasi backend
|
|
|
|
|
../../runtime/thirdparty/dist/lib/libuv_a.a:
|
|
|
|
|
make -C ../../runtime/thirdparty libuv.install
|
|
|
|
|
|
|
|
|
|
../../runtime/thirdparty/dist/lib/libuvwasi_a.a:
|
|
|
|
|
make -C ../../runtime/thirdparty dist/lib/libuvwasi_a.a:
|
|
|
|
|
|
|
|
|
|
.PHONY: ../../runtime/thirdparty/dist/include
|
|
|
|
|
../../runtime/thirdparty/dist/include:
|
|
|
|
|
make -C ../../runtime/thirdparty dist/include/wasi
|
|
|
|
|
|
|
|
|
|
UVWASI_CFILES=../../runtime/runtime.c ../../runtime/libc/wasi/wasi_backing.c ../../runtime/libc/wasi/wasi_main.c ../../runtime/libc/wasi/wasi_impl_uvwasi.c ../../runtime/libc/env.c ../../runtime/memory/64bit_nix.c
|
|
|
|
|
UVWASI_LIBS=../../runtime/thirdparty/dist/lib/libuvwasi_a.a ../../runtime/thirdparty/dist/lib/libuv_a.a
|
|
|
|
|
UVWASI_INCLUDES=-I../../runtime/libc/wasi/include -I../../runtime/thirdparty/dist/include
|
|
|
|
|
|
|
|
|
|
%_uvwasi: %.bc ${UVWASI_CFILES} ${UVWASI_LIBS}
|
|
|
|
|
clang -pthread -ldl -lm ${OPTFLAGS} ${RUNTIME_CFLAGS} ${UVWASI_INCLUDES} $^ -o $@
|
|
|
|
|
|
|
|
|
|
# Using minimal backend
|
|
|
|
|
MINIMAL_CFILES=${RUNTIME_CFILES} ${RUNTIME_PATH}/libc/wasi/wasi_backing.c ${RUNTIME_PATH}/libc/wasi/wasi_main.c ${RUNTIME_PATH}/libc/wasi/wasi_impl_minimal.c
|
|
|
|
|
MINIMAL_INCLUDES=-I${RUNTIME_PATH}/libc/
|
|
|
|
|
|
|
|
|
|
%_minimal: %.bc ${MINIMAL_CFILES} ../../runtime/thirdparty/dist/include
|
|
|
|
|
clang -lm ${OPTFLAGS} ${RUNTIME_CFLAGS} ${MINIMAL_INCLUDES} ${MINIMAL_CFILES} $< -o $@
|
|
|
|
|
|
|
|
|
|
all: \
|
|
|
|
|