From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- .../rust/lucet-wasi-wasmsbx/examples/Makefile | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 third_party/rust/lucet-wasi-wasmsbx/examples/Makefile (limited to 'third_party/rust/lucet-wasi-wasmsbx/examples/Makefile') diff --git a/third_party/rust/lucet-wasi-wasmsbx/examples/Makefile b/third_party/rust/lucet-wasi-wasmsbx/examples/Makefile new file mode 100644 index 0000000000..bbca5518ab --- /dev/null +++ b/third_party/rust/lucet-wasi-wasmsbx/examples/Makefile @@ -0,0 +1,54 @@ +WASI_CC ?= /opt/wasi-sdk/bin/clang +WASI_LD ?= /opt/wasi-sdk/bin/wasm-ld + +default: run-hello + +.PHONY: run-hello +run-hello: build/hello.so + cargo run -p lucet-wasi -- ./build/hello.so + +.PHONY: run-hello-all +run-hello-all: run-hello + cargo run -p lucet-wasi -- ./build/hello.so -- "makefile user" + GREETING="goodbye" cargo run -p lucet-wasi -- ./build/hello.so -- "makefile user" + +build/hello.so: build/hello.wasm ../bindings.json + cargo run -p lucetc -- $< --bindings ../bindings.json -o $@ + +build/hello.wasm: hello.c + mkdir -p build + $(WASI_CC) $< -o $@ + +build/hello.wat: build/hello.wasm + wasm2wat -f $< > $@ + +.PHONY: run-pseudoquine +run-pseudoquine: build/pseudoquine.so + cargo run -p lucet-wasi -- ./build/pseudoquine.so --dir "$(CURDIR):/examples" + +build/pseudoquine.so: build/pseudoquine.wasm ../bindings.json + cargo run -p lucetc -- $< --bindings ../bindings.json -o $@ + +build/pseudoquine.wasm: pseudoquine.c + mkdir -p build + $(WASI_CC) $< -o $@ + +build/pseudoquine.wat: build/pseudoquine.wasm + wasm2wat -f $< > $@ + +.PHONY: run-kgt +run-kgt: build/kgt.so + cargo run -p lucet-wasi -- ./build/kgt.so -- -l bnf -e rrutf8 < build/kgt/examples/expr.bnf + +build/kgt.so: build/kgt/build/bin/kgt ../bindings.json + cargo run -p lucetc -- $< --bindings ../bindings.json -o $@ + +build/kgt/build/bin/kgt: build/kgt + NOSTRIP=1 CC=$(WASI_CC) LD=$(WASI_LD) pmake -C build/kgt -r all + +build/kgt: + git clone --recursive https://github.com/katef/kgt.git build/kgt + +.PHONY: clean +clean: + @rm -rf build -- cgit v1.2.3