summaryrefslogtreecommitdiff
path: root/c/wasmtime-basic/Makefile
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-10-26 22:43:46 +0100
committerAndrew Clayton <a.clayton@nginx.com>2023-10-26 22:51:19 +0100
commit4904aa341be9c74dec28e6eeea79b707211f2f06 (patch)
tree42666e982dc311b409f315a578e673664dce9d24 /c/wasmtime-basic/Makefile
parent3aed80812e105cd99c43f11023012608aecd9f4a (diff)
downloadproject_blackbird-4904aa341be9c74dec28e6eeea79b707211f2f06.tar.gz
project_blackbird-4904aa341be9c74dec28e6eeea79b707211f2f06.tar.bz2
Add a basic C based wasmtime runtime
This can be used for creating an equivalent rust based runtime with C bindings. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'c/wasmtime-basic/Makefile')
-rw-r--r--c/wasmtime-basic/Makefile17
1 files changed, 17 insertions, 0 deletions
diff --git a/c/wasmtime-basic/Makefile b/c/wasmtime-basic/Makefile
new file mode 100644
index 0000000..ad70fce
--- /dev/null
+++ b/c/wasmtime-basic/Makefile
@@ -0,0 +1,17 @@
+CC = gcc
+CFLAGS = -Wall -Wextra -g -I$(WASMTIME_C_API)/include -L$(WASMTIME_C_API)/lib
+LDFLAGS = -Wl,-rpath,$(WASMTIME_C_API)/lib
+
+WASM_CC = clang
+WASM_CFLAGS = -Wall -Wextra -fno-strict-aliasing --target=wasm32-wasi --sysroot=$(WASI_SYSROOT)
+
+all: wasmtime test.wasm
+
+wasmtime: wasmtime.c
+ $(CC) $(CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< -lwasmtime
+
+test.wasm: test.c
+ $(WASM_CC) $(WASM_CFLAGS) -o $@ $<
+
+clean:
+ rm -f wasmtime test.wasm