summaryrefslogtreecommitdiffhomepage
path: root/examples/rust/Makefile
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2025-05-14 17:00:23 +0100
committerAndrew Clayton <a.clayton@nginx.com>2025-05-14 18:09:44 +0100
commit12763f6351d0c25b6f90dd7adbe0da3896d8e9c9 (patch)
treefb185f27976f7bcc4e12de42fab72731efaa874b /examples/rust/Makefile
parent4d4f1f2284d54dfabf58246034b8fc7fd0282f83 (diff)
downloadunit-wasm-12763f6351d0c25b6f90dd7adbe0da3896d8e9c9.tar.gz
unit-wasm-12763f6351d0c25b6f90dd7adbe0da3896d8e9c9.tar.bz2
rust: Fix building of unit-wasm and rust examples
When building the rust stuff we were getting the following compiler error error: failed to run `rustc` to learn about target-specific information ... --- stderr error: Error loading target specification: Could not find specification for target "wasm32-wasi". Run `rustc --print target-list` for a list of built-in targets This is due to wasm32-wasi being renamed to wasm32-wasip1, with wasm32-wasi being kept clear for an eventual WASI 1.0 release. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'examples/rust/Makefile')
-rw-r--r--examples/rust/Makefile19
1 files changed, 11 insertions, 8 deletions
diff --git a/examples/rust/Makefile b/examples/rust/Makefile
index 3d2570d..f88bbb9 100644
--- a/examples/rust/Makefile
+++ b/examples/rust/Makefile
@@ -1,5 +1,8 @@
include ../../shared.mk
+TARGET = wasm32-wasip1
+CARGO_CMD = cargo build --target=$(TARGET)
+
SDIR = examples/rust
examples: rust-echo-request \
@@ -8,20 +11,20 @@ examples: rust-echo-request \
rust-large-upload
rust-echo-request: echo-request/Cargo.toml echo-request/src/lib.rs
- $(PP_GEN) $(SDIR)/echo-request/target/wasm32-wasi/
- $(v)cd echo-request; cargo build --target=wasm32-wasi
+ $(PP_GEN) $(SDIR)/echo-request/target/$(TARGET)/
+ $(v)cd echo-request; $(CARGO_CMD)
rust-upload-reflector: upload-reflector/Cargo.toml upload-reflector/src/lib.rs
- $(PP_GEN) $(SDIR)/upload-reflector/target/wasm32-wasi/
- $(v)cd upload-reflector; cargo build --target=wasm32-wasi
+ $(PP_GEN) $(SDIR)/upload-reflector/target/$(TARGET)/
+ $(v)cd upload-reflector; $(CARGO_CMD)
rust-hello-world: hello-world/Cargo.toml hello-world/src/lib.rs
- $(PP_GEN) $(SDIR)/hello-world/target/wasm32-wasi/
- $(v)cd hello-world; cargo build --target=wasm32-wasi
+ $(PP_GEN) $(SDIR)/hello-world/target/$(TARGET)/
+ $(v)cd hello-world; $(CARGO_CMD)
rust-large-upload: large-upload/Cargo.toml large-upload/src/lib.rs
- $(PP_GEN) $(SDIR)/large-upload/target/wasm32-wasi/
- $(v)cd large-upload; cargo build --target=wasm32-wasi
+ $(PP_GEN) $(SDIR)/large-upload/target/$(TARGET)/
+ $(v)cd large-upload; $(CARGO_CMD)
clean:
rm -f */Cargo.lock