Makefile -rw-r--r-- 1.8 KiB
1.POSIX:
2.SUFFIXES:
3CARGOBIN = cargo
4CARGOSORTBIN = cargo-sort
5DJHTMLBIN = djhtml
6BLACKBIN = black
7PRINTF = /usr/bin/printf
8
9HTML_FILES := $(shell find mailpot-web/src/templates -type f -print0 | tr '\0' ' ')
10PY_FILES := $(shell find . -type f -name '*.py' -print0 | tr '\0' ' ')
11
12.PHONY: check
13check:
14 @$(CARGOBIN) check --all-features --all --tests --examples --benches --bins
15
16.PHONY: fmt
17fmt:
18 @$(CARGOBIN) +nightly fmt --all || $(CARGOBIN) fmt --all
19 @OUT=$$($(CARGOSORTBIN) -w 2>&1) || $(PRINTF) "ERROR: %s cargo-sort failed or binary not found in PATH.\n" "$$OUT"
20 @OUT=$$($(DJHTMLBIN) $(HTML_FILES) 2>&1) || $(PRINTF) "ERROR: %s djhtml failed or binary not found in PATH.\n" "$$OUT"
21 @OUT=$$($(BLACKBIN) -q $(PY_FILES) 2>&1) || $(PRINTF) "ERROR: %s black failed or binary not found in PATH.\n" "$$OUT"
22
23.PHONY: lint
24lint:
25 @$(CARGOBIN) clippy --no-deps --all-features --all --tests --examples --benches --bins
26
27
28.PHONY: test
29test: check lint
30 @$(CARGOBIN) nextest run --all --no-fail-fast --all-features
31
32.PHONY: rustdoc
33rustdoc:
34 @RUSTDOCFLAGS="--html-before-content ./.github/doc_extra.html" $(CARGOBIN) doc --workspace --all-features --no-deps --document-private-items
35
36.PHONY: rustdoc-open
37rustdoc-open:
38 @RUSTDOCFLAGS="--html-before-content ./.github/doc_extra.html" $(CARGOBIN) doc --workspace --all-features --no-deps --document-private-items --open
39
40.PHONY: rustdoc-nightly
41rustdoc-nightly:
42 @RUSTDOCFLAGS="--html-before-content ./.github/doc_extra.html" $(CARGOBIN) +nightly doc -Zrustdoc-map -Z rustdoc-scrape-examples --workspace --all-features --no-deps --document-private-items
43
44.PHONY: rustdoc-nightly-open
45rustdoc-nightly-open:
46 @RUSTDOCFLAGS="--html-before-content ./.github/doc_extra.html" $(CARGOBIN) +nightly doc -Zrustdoc-map -Z rustdoc-scrape-examples --workspace --all-features --no-deps --document-private-items --open