-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (62 loc) · 2.51 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
NAME = $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')
VERSION = $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
DEB_PACKAGE = $(NAME)_$(VERSION)_amd64.deb
TGZ_PACKAGE = $(NAME)_$(VERSION)_linux_amd64.tar.gz
all: build
.PHONY: all
build:
@cargo build --all-targets --target x86_64-unknown-linux-musl
.PHONY: build
release:
@cargo build --release --all-targets --target x86_64-unknown-linux-musl
.PHONY: release
test:
@RUST_BACKTRACE=1 cargo test --target x86_64-unknown-linux-musl
.PHONY: test
check:
@cargo check --all-targets --target x86_64-unknown-linux-musl
.PHONY: check
doc:
@cargo doc --workspace
.PHONY: doc
clean:
@rm -rf *.log pkg
.PHONY: clean
cleanall: clean
@cargo clean
.PHONY: cleanall
completion: release
@mkdir -p target/x86_64-unknown-linux-musl/release/completion
@./target/x86_64-unknown-linux-musl/release/rbw gen-completions bash > target/x86_64-unknown-linux-musl/release/completion/bash
@./target/x86_64-unknown-linux-musl/release/rbw gen-completions zsh > target/x86_64-unknown-linux-musl/release/completion/zsh
@./target/x86_64-unknown-linux-musl/release/rbw gen-completions fish > target/x86_64-unknown-linux-musl/release/completion/fish
.PHONY: completion
package: pkg/$(DEB_PACKAGE) pkg/$(TGZ_PACKAGE)
.PHONY: package
pkg:
@mkdir pkg
pkg/$(DEB_PACKAGE): release completion | pkg
@cargo deb --no-build --target x86_64-unknown-linux-musl && mv target/x86_64-unknown-linux-musl/debian/$(DEB_PACKAGE) pkg
pkg/$(DEB_PACKAGE).minisig: pkg/$(DEB_PACKAGE)
@minisign -Sm $<
pkg/$(TGZ_PACKAGE): release completion | pkg
@tar czf $@ -C target/x86_64-unknown-linux-musl/release rbw rbw-agent completion
release-dir-deb:
@ssh tozt.net mkdir -p releases/rbw/deb
.PHONY: release-dir-deb
publish: publish-crates-io publish-git-tags publish-deb publish-github
.PHONY: publish
publish-crates-io: test
@cargo publish
.PHONY: publish-crates-io
# force shell instead of exec to work around
# https://savannah.gnu.org/bugs/?57962 since i have ~/.bin/git as a directory
publish-git-tags: test
@:; git tag $(VERSION)
@:; git push --tags
.PHONY: publish-git-tags
publish-deb: test pkg/$(DEB_PACKAGE) pkg/$(DEB_PACKAGE).minisig release-dir-deb
@scp pkg/$(DEB_PACKAGE) pkg/$(DEB_PACKAGE).minisig tozt.net:releases/rbw/deb
.PHONY: publish-deb
publish-github: test pkg/$(TGZ_PACKAGE)
@perl -nle'print if /^## \Q[$(VERSION)]/../^## (?!\Q[$(VERSION)]\E)/' CHANGELOG.md | head -n-2 | gh release create $(VERSION) --verify-tag --notes-file - pkg/$(TGZ_PACKAGE)