-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
62 lines (48 loc) · 1.48 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
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
RFC_6890_TXT := $(ROOT_DIR)/ift-gen/src/rfc6890_entries.txt
RFC_6890_ENTRIES_RS := $(ROOT_DIR)/src/rfc/rfc6890_entries.rs
.PHONY: pre-hook
pre-hook: lint fmt fix
.PHONY: lint
lint:
cargo clippy
.PHONY: fix
fix:
cargo fix --edition-idioms --broken-code
.PHONY: fmt
fmt:
cargo +nightly fmt --all
.PHONY: download
download:
curl -s https://tools.ietf.org/rfc/rfc6890.txt > $(RFC_6890_TXT)
.PHONY: gen-rfc-6890
gen-rfc-6890:
# first create a dummy file
echo "use crate::rfc::WithRfc6890;" > $(RFC_6890_ENTRIES_RS)
echo "pub fn entries() -> WithRfc6890 { WithRfc6890 { entries: vec![] }}" >> $(RFC_6890_ENTRIES_RS)
# then write the real one to a tmp loc
echo "use crate::rfc::WithRfc6890;" > $(RFC_6890_ENTRIES_RS).tmp
echo "use crate::rfc::Rfc6890Entry;" >> $(RFC_6890_ENTRIES_RS).tmp
echo "pub fn entries() -> WithRfc6890 { WithRfc6890 { entries: vec![" >> $(RFC_6890_ENTRIES_RS).tmp
cargo run -p ift-gen -- rfc 6890 >> $(RFC_6890_ENTRIES_RS).tmp
echo "]}}" >> $(RFC_6890_ENTRIES_RS).tmp
# then move it into the correct loc
mv $(RFC_6890_ENTRIES_RS).tmp $(RFC_6890_ENTRIES_RS)
.PHONY: gen
gen: download gen-rfc-6890 fmt
.PHONY: update
update:
cargo readme > README.md
.PHONY: test
test:
cargo test
.PHONY: dev-tools
dev-tools:
rustup install nightly
rustup component add rustfmt --toolchain nightly
rustup component add clippy
cargo install cargo-release
cargo install cargo-readme
.PHONY: clean
clean:
cargo clean