-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
44 lines (32 loc) · 1.64 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
# reference: https://github.com/dalance/procs/blob/master/Makefile
VERSION=$(patsubst "%",%, $(word 3, $(shell grep version Cargo.toml)))
BUILD_TIME=$(shell date +"%Y/%m/%d %H:%M:%S")
GIT_REVISION=$(shell git log -1 --format="%h")
RUST_VERSION=$(word 2, $(shell rustc -V))
LONG_VERSION="$(VERSION) ( rev: $(GIT_REVISION), rustc: $(RUST_VERSION), build at: $(BUILD_TIME) )"
BIN_NAME=ultraman
BASE_RELEASE_FILES := ./tmp/ultraman.1 README.md LICENSE
export LONG_VERSION
.PHONY: create_man man install_man test release_linux release_win release_mac
create_man:
if [ ! -d ./tmp ]; then mkdir ./tmp; fi && cargo run --bin man --features man > ./tmp/ultraman.1;
man: create_man
man ./tmp/ultraman.1;
install_man: create_man
install -Dm644 ./tmp/ultraman.1 /usr/local/share/man/man1/ultraman.1;
test:
cargo test --locked
cargo test --locked -- --ignored
cargo test --locked -- --nocapture
test-no-default-features:
cargo test --locked --no-default-features
cargo test --locked --no-default-features -- --ignored
release_linux: create_man
cargo build --locked --release --target=x86_64-unknown-linux-musl
zip -j ${BIN_NAME}-v${VERSION}-x86_64-linux.zip target/x86_64-unknown-linux-musl/release/${BIN_NAME} $(strip $(BASE_RELEASE_FILES))
release_win: create_man
cargo build --locked --release --target=x86_64-pc-windows-msvc
7z a ${BIN_NAME}-v${VERSION}-x86_64-win.zip target/x86_64-pc-windows-msvc/release/${BIN_NAME}.exe $(strip $(BASE_RELEASE_FILES))
release_mac: create_man
cargo build --locked --release --target=x86_64-apple-darwin
zip -j ${BIN_NAME}-v${VERSION}-x86_64-mac.zip target/x86_64-apple-darwin/release/${BIN_NAME} $(strip $(BASE_RELEASE_FILES))