forked from ref-finance/ref-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (39 loc) · 1.5 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
RFLAGS="-C link-arg=-s"
build: ref-exchange
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p ref-exchange --target wasm32-unknown-unknown --release
RUSTFLAGS=$(RFLAGS) cargo build -p ref_farming --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/ref_exchange.wasm ./res/ref_exchange.wasm
cp target/wasm32-unknown-unknown/release/ref_farming.wasm ./res/ref_farming.wasm
test: build mock-ft
RUSTFLAGS=$(RFLAGS) cargo test -p ref-exchange
test-farm: build mock-ft
RUSTFLAGS=$(RFLAGS) cargo test -p ref_farming
test-release: mock-ft
mkdir -p res
cp ./releases/ref_exchange_release.wasm ./res/ref_exchange.wasm
RUSTFLAGS=$(RFLAGS) cargo test -p ref-exchange
mock-ft: test-token
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p test-token --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/test_token.wasm ./res/test_token.wasm
release:
$(call docker_build,_rust_setup.sh)
mkdir -p res
cp target/wasm32-unknown-unknown/release/ref_exchange.wasm res/ref_exchange_release.wasm
cp target/wasm32-unknown-unknown/release/ref_farming.wasm res/ref_farming_release.wasm
clean:
cargo clean
rm -rf res/
define docker_build
docker build -t my-contract-builder .
docker run \
--mount type=bind,source=${PWD},target=/host \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
-w /host \
-e RUSTFLAGS=$(RFLAGS) \
-i -t my-contract-builder \
/bin/bash $(1)
endef