forked from nervosnetwork/tentacle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (34 loc) · 1.19 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
FLATC := flatc
CFBC := cfbc
FBS_FILES := \
src/protocol_select/protocol_select.fbs \
secio/src/handshake/handshake.fbs \
protocols/identify/src/protocol.fbs \
protocols/ping/src/protocol.fbs \
protocols/discovery/src/protocol.fbs
FLATC_RUST_FILES := $(patsubst %.fbs,%_generated.rs,${FBS_FILES})
FLATBUFFERS_VERIFIER_FILES := $(patsubst %.fbs,%_generated_verifier.rs,${FBS_FILES})
fmt:
cargo fmt --all -- --check
clippy:
RUSTFLAGS='-F warnings' cargo clippy --all --tests
test:
RUSTFLAGS='-F warnings' RUST_BACKTRACE=full cargo test --all
examples:
cargo build --examples --all
bench_p2p:
cd bench && cargo run --release && cd ..
ci: fmt clippy test examples bench_p2p
git diff --exit-code Cargo.lock
check-cfbc-version:
test "$$($(CFBC) --version)" = 0.1.9
%_generated_verifier.rs: %.fbs check-cfbc-version
$(FLATC) -b --schema -o $(shell dirname $@) $<
$(CFBC) -o $(shell dirname $@) $*.bfbs
rm -f $*_builder.rs $*.bfbs
%_generated.rs: %.fbs
$(FLATC) -r -o $(shell dirname $@) $<
gen-fb: $(FLATC_RUST_FILES) $(FLATBUFFERS_VERIFIER_FILES)
clean-fb:
rm -f $(FLATC_RUST_FILES) $(FLATBUFFERS_VERIFIER_FILES)
.PHONY: fmt clippy test examples ci gen-fb clean-fb check-cfbc-version