-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
49 lines (37 loc) · 1.11 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
CARGO := cargo
CLIPPY_COMMAND := cargo clippy -- -D warning
BINARIES := $(patsubst %.rs,%,$(notdir $(wildcard src/bin/*.rs)))
BINARIES_CHECK_TARGETS := $(addprefix check-,$(BINARIES))
BINARIES_LINT_TARGETS := $(addprefix lint-,$(BINARIES))
default: test
.PHONY: test # Run cargo test
test:
$(CARGO) test
.PHONY: $(BINARIES_CHECK_TARGETS)
$(BINARIES_CHECK_TARGETS):
$(CARGO) check --bin $(patsubst check-%,%,$@)
.PHONY: check-lib
check-lib:
$(CARGO) check --lib
.PHONY: check # Quickly validate all binaries compiles
check: | check-lib $(BINARIES_CHECK_TARGETS)
.PHONY: lint # Lint all binaries against clippy
lint:
$(CLIPPY_COMMAND)
.PHONY: outdated # List outdated dependency information
outdated:
$(CARGO) outdated -R
.PHONY: install # Installs the project using cargo
install:
@-$(CARGO) uninstall pickpocket
$(CARGO) install
.PHONY: clean # Cleanup older compilation results
clean:
$(CARGO) clean
.PHONY: fmt # Formats the source files using rustfmt
fmt:
$(CARGO) fmt
.PHONY: help # Shows the acailable tasks
help:
@echo "Available options:"
@grep '^.PHONY: [^#]\+ #' Makefile | cut -d: -f2- | sed 's/#/-/' | sort