-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
52 lines (37 loc) · 1.68 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
CANISTER_INFO=dist/canister-info
LAUNCH_TRAIL=dist/launchtrail.wasm dist/launchtrail.did
HELLO=dist/hello.wasm dist/hello.did
TESTS=configure install
ARGUMENT=(record {bucket_size = 1000 : nat64; max_buckets = 1000 : nat64; config = record { revokers = vec { principal "SUBMITTER" }; submitters = vec { principal "SUBMITTER" }; min_schedule = 0 : nat64;}})
CARGO_BUILD?=release
CARGO_FLAGS?=--release
default: $(LAUNCH_TRAIL) $(HELLO) dist/canister-info
release:
$(MAKE) CARGO_FLAGS="--release --locked" CARGO_BUILD=release $(LAUNCH_TRAIL) $(CANISTER_INFO)
dist:
mkdir -p dist
target/wasm32-unknown-unknown/$(CARGO_BUILD)/%.wasm: src/%.rs
cargo build $(CARGO_FLAGS) --target=wasm32-unknown-unknown --bin $(subst src/,,$(subst .rs,,$<))
dist/%.wasm: target/wasm32-unknown-unknown/$(CARGO_BUILD)/%.wasm | dist
wasm-opt -O2 $< -o $@
target/$(CARGO_BUILD)/canister-info: src/canister-info.rs
cargo build $(CARGO_FLAGS) --bin canister-info
dist/canister-info: target/$(CARGO_BUILD)/canister-info | dist
cp $< $@
dist/%.did: dist/%.wasm | dist
cargo run $(CARGO_FLAGS) --bin $(subst dist/,,$(subst .wasm,,$<)) > $@
dist/seed.txt: | dist
keysmith generate -o $@
dist/private.pem: dist/seed.txt | dist
keysmith private-key -f $< -o $@
dfx.json:
echo '{"canisters":{"launchtrail":{"type":"custom","candid":"dist/launchtrail.did","wasm":"dist/launchtrail.wasm","build":""}}}' > $@
deploy: dfx.json
dfx deploy launchtrail $(OPTS) --argument "$$(echo '$(ARGUMENT)'|sed -e "s/SUBMITTER/$$(dfx identity get-principal)/g")"
test: default dist/private.pem
cd tests && ./run.sh $(TESTS)
clean:
rm -rf dist
rm -rf target
rm -rf test/test-????????.repl test/config.dhall
.PHONY: default release test deploy clean