forked from nervosnetwork/ckb
/
Makefile
82 lines (61 loc) · 2.15 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
FLATC := flatc
CFBC := cfbc
VERBOSE := $(if ${CI},--verbose,)
test:
cargo test ${VERBOSE} --all -- --nocapture
integration:
cargo build ${VERBOSE}
cd test && cargo run ../target/debug/ckb
integration-release:
cargo build ${VERBOSE} --release
cd test && cargo run --release -- ../target/release/ckb
doc:
cargo doc --all --no-deps
doc-deps:
cargo doc --all
check:
cargo check ${VERBOSE} --all
cd test && cargo check ${VERBOSE} --all
build:
cargo build ${VERBOSE} --release
prod:
RUSTFLAGS="--cfg disable_faketime" cargo build ${VERBOSE} --release
prod-test:
RUSTFLAGS="--cfg disable_faketime" RUSTDOCFLAGS="--cfg disable_faketime" cargo test ${VERBOSE} --all -- --nocapture
fmt:
cargo fmt ${VERBOSE} --all -- --check
cd test && cargo fmt ${VERBOSE} --all -- --check
clippy:
cargo clippy ${VERBOSE} --all --all-targets --all-features -- -D warnings -D clippy::clone_on_ref_ptr -D clippy::enum_glob_use -D clippy::fallible_impl_from
cd test && cargo clippy ${VERBOSE} --all --all-targets --all-features -- -D warnings -D clippy::clone_on_ref_ptr -D clippy::enum_glob_use -D clippy::fallible_impl_from
ci: fmt clippy test
git diff --exit-code Cargo.lock
info:
date
pwd
env
# For counting lines of code
stats:
@cargo count --version || cargo +nightly install --git https://github.com/kbknapp/cargo-count
@cargo count --separator , --unsafe-statistics
# Use cargo-audit to audit Cargo.lock for crates with security vulnerabilities
# expecting to see "Success No vulnerable packages found"
security-audit:
@cargo audit --version || cargo install cargo-audit
@cargo audit
docker:
docker build -f docker/hub/Dockerfile -t nervos/ckb:latest .
GEN_FILES := protocol/src/protocol_generated.rs protocol/src/protocol_generated_verifier.rs
gen: ${GEN_FILES}
gen-clean:
rm -f ${GEN_FILES}
%_generated.rs: %.fbs
$(FLATC) -r -o $(shell dirname $@) $<
%_generated_verifier.rs: %.fbs
$(FLATC) -b --schema -o $(shell dirname $@) $<
$(CFBC) -o $(shell dirname $@) $*.bfbs
rm -f $*.bfbs $*_builder.rs
.PHONY: build prod prod-test docker gen gen-clean
.PHONY: fmt test clippy doc doc-deps check stats
.PHONY: ci info security-audit
.PHONY: integration integration-release