-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (40 loc) · 1.54 KB
/
Makefile
File metadata and controls
54 lines (40 loc) · 1.54 KB
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
49
50
51
52
53
54
RFLAGS="-C link-arg=-s"
build: lint satoshi-bridge nbtc mock-chain-signatures mock-btc-light-client mock-dapp
lint:
@cargo fmt --all
@cargo clippy --fix --allow-dirty --allow-staged
satoshi-bridge: contracts/satoshi-bridge
$(call local_build_wasm,satoshi-bridge,satoshi_bridge)
nbtc: contracts/nbtc
$(call local_build_wasm,nbtc,nbtc)
mock-dapp: contracts/mock-dapp
$(call local_build_wasm,mock-dapp,mock_dapp)
mock-chain-signatures: contracts/mock-chain-signatures
$(call local_build_wasm,mock-chain-signatures,mock_chain_signatures)
mock-btc-light-client: contracts/mock-btc-light-client
$(call local_build_wasm,mock-btc-light-client,mock_btc_light_client)
count:
@tokei ./contracts/satoshi-bridge/src/ --files --exclude unit
@tokei ./contracts/nbtc/src/ --files
release:
$(call build_release_wasm,satoshi-bridge,satoshi_bridge)
$(call build_release_wasm,nbtc,nbtc)
clean:
cargo clean
rm -rf res/
define local_build_wasm
$(eval PACKAGE_NAME := $(1))
$(eval WASM_NAME := $(2))
@mkdir -p res
@rustup target add wasm32-unknown-unknown
@cargo near build non-reproducible-wasm --manifest-path ./contracts/${PACKAGE_NAME}/Cargo.toml --locked --no-abi
@cp target/near/${WASM_NAME}/$(WASM_NAME).wasm ./res/$(WASM_NAME).wasm
endef
define build_release_wasm
$(eval PACKAGE_NAME := $(1))
$(eval WASM_NAME := $(2))
@mkdir -p res
@rustup target add wasm32-unknown-unknown
@cargo near build reproducible-wasm --manifest-path ./contracts/${PACKAGE_NAME}/Cargo.toml
@cp target/near/${WASM_NAME}/$(WASM_NAME).wasm ./res/$(WASM_NAME)_release.wasm
endef