-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (37 loc) · 1.23 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
CARGO_TARGET_DIR ?= target
CARGO_TARGET ?= x86_64-unknown-linux-gnu
PKG_BASE_NAME ?= timer-${CARGO_TARGET}
PROJECT_VERSION := $(shell sed -n 's/^version = "\(.*\)"/\1/p' ./Cargo.toml | head -n1)
.DEFAULT: help
.PHONY: help
help: ## Show this help menu.
@echo "Usage: make [TARGET ...]"
@echo ""
@@egrep -h "#[#]" $(MAKEFILE_LIST) | sed -e 's/\\$$//' | awk 'BEGIN {FS = "[:=].*?#[#] "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@echo ""
.PHONY: build
build: ## compile timer
build:
cargo build --release
.PHONY: lint
lint: ## lint code
lint:
cargo clippy --locked --all-targets --all-features -- -D warnings
cargo fmt -- --check
.PHONY: test
test: ## run tests
test: lint
cargo test
.PHONY: update-changelog
update-changelog: ## automatically update changelog based on commits
git cliff -t v$(PROJECT_VERSION) -u -p CHANGELOG.md
.PHONY: release
release: ## generate vendor.tar.gz and $(PKG_BASE_NAME).tar.gz
cargo vendor
tar -czf vendor.tar.gz vendor
cargo build --frozen --release --all-features --target ${CARGO_TARGET}
tar -czf $(PKG_BASE_NAME).tar.gz -C $(CARGO_TARGET_DIR)/$(CARGO_TARGET)/release timer
@echo Released in $(CARGO_TARGET_DIR)/$(CARGO_TARGET)/release/timer
.PHONY: publish
publish: ## publish crate
cargo publish