-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile
35 lines (28 loc) · 1.12 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
SUBDIRS = rust-basic rust-fetch rust-kv rust-wasi-nn rust-wasi-nn-preload rust-pdf-create
COMPONENTS = components/rust-basic components/rust-kv
all: $(SUBDIRS) rust-params $(COMPONENTS) components/rust-params
.PHONY: $(SUBDIRS) rust-params $(COMPONENTS) components/rust-params js-hono
$(SUBDIRS):
cd $@ && \
cargo build --target wasm32-wasi --release && \
cp target/wasm32-wasi/release/[email protected] ./[email protected]
rust-params:
cd $@ && \
cargo build --target wasm32-wasi --release && \
cp target/wasm32-wasi/release/[email protected] "./[id].wasm"
js-hono:
cd $@/src && \
npm install && npm run build
$(COMPONENTS):
mkdir -p $@
make $(@:components/%=%)
cp $(@:components/%=%)/$(@:components/%=%).toml $@/
wasm-tools component new $(@:components/%=%)/$(@:components/%=%).wasm \
--adapt wasi_snapshot_preview1=components/wasi-component-adapter/wasi_snapshot_preview1-command.wasm \
-o $@/$(@:components/%=%).wasm
components/rust-params:
mkdir -p $@
make rust-params
wasm-tools component new rust-params/[id].wasm \
--adapt wasi_snapshot_preview1=components/wasi-component-adapter/wasi_snapshot_preview1-command.wasm \
-o $@/[id].wasm