-
Notifications
You must be signed in to change notification settings - Fork 55
/
Makefile
97 lines (80 loc) · 3.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
RFLAGS="-C link-arg=-s"
build: build-exchange
build-exchange: ref-exchange
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p ref-exchange --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/ref_exchange.wasm ./res/ref_exchange.wasm
build-farm: ref-farming
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p ref_farming --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/ref_farming.wasm ./res/ref_farming.wasm
unittest: build-exchange
ifdef TC
RUSTFLAGS=$(RFLAGS) cargo test $(TC) -p ref-exchange --lib -- --nocapture
else
RUSTFLAGS=$(RFLAGS) cargo test -p ref-exchange --lib -- --nocapture
endif
test: build-exchange mock-ft mock-rated mock-farming test-wnear test-price-oracle test-pyth
ifdef TF
RUSTFLAGS=$(RFLAGS) cargo test -p ref-exchange --test $(TF) -- --nocapture
else
RUSTFLAGS=$(RFLAGS) cargo test -p ref-exchange --tests
endif
test-exchange: build-exchange mock-ft mock-rated mock-farming test-wnear test-price-oracle test-pyth
RUSTFLAGS=$(RFLAGS) cargo test -p ref-exchange
test-farm: build-farm mock-ft
RUSTFLAGS=$(RFLAGS) cargo test -p ref_farming
test-release: mock-ft mock-rated mock-farming test-wnear test-price-oracle test-pyth
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
mock-rated: test-rated-token
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p test-rated-token --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/test_rated_token.wasm ./res/test_rated_token.wasm
mock-farming: mock-boost-farming
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p mock-boost-farming --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/mock_boost_farming.wasm ./res/mock_boost_farming.wasm
test-wnear: mock-wnear
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p mock-wnear --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/mock_wnear.wasm ./res/mock_wnear.wasm
test-price-oracle: mock-price-oracle
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p mock-price-oracle --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/mock_price_oracle.wasm ./res/mock_price_oracle.wasm
test-pyth: mock-pyth
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p mock-pyth --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/mock_pyth.wasm ./res/mock_pyth.wasm
release:
$(call docker_build,_rust_setup.sh)
mkdir -p res
cp target/wasm32-unknown-unknown/release/ref_exchange_by_wasm_opt.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