-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
49 lines (39 loc) · 1.3 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
36
37
38
39
40
41
42
43
44
45
46
47
48
TAG?=latest
.PHONY: all
all: pkg pkg_multicore js/pivx_shield.js js/README.md
pkg: src/ Cargo.toml
wasm-pack build --target web
sed -i 's/pivx_shield_rust_bg.wasm/*/' pkg/package.json
cp wrong-package.md pkg/README.md
pkg_multicore: src/ Cargo.toml
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \
rustup run nightly-2024-09-05 \
wasm-pack build --weak-refs --out-dir "pkg_multicore" --target web -- --features="multicore" -Z build-std=panic_abort,std
sed -i 's/pivx-shield-rust/pivx-shield-rust-multicore/' pkg_multicore/package.json
sed -i 's/pivx_shield_rust_bg.wasm/*/' pkg_multicore/package.json
sed -i 's+../../../+../../../pivx_shield_rust.js+g' pkg_multicore/snippets/wasm-bindgen-rayon*/src/worker*.js
cp wrong-package.md pkg_multicore/README.md
js/README.md: README.md
cp README.md js/
js/pivx_shield.js: js/pivx_shield.ts js/node_modules
cd js/; \
npm run build
js/node_modules: js/package.json
cd js/; (npm ci || npm i)
.PHONY: publish
publish: all
cd pkg; npm publish --tag $(TAG)
cd pkg_multicore; npm publish --tag $(TAG)
cd js; npm publish --tag $(TAG)
.PHONE: pack
pack: all
cd pkg; npm pack
cd pkg_multicore; npm pack
cd js; npm pack
.PHONY: clean
clean:
cargo clean
-rm -rf pkg/
-rm -rf pkg_multicore/
-rm -rf js/node_modules
-rm js/pivx_shield.d.ts