1 | .POSIX: |
2 | .SUFFIXES: |
3 | CARGOBIN = cargo |
4 | CARGOSORTBIN = cargo-sort |
5 | DJHTMLBIN = djhtml |
6 | BLACKBIN = black |
7 | PRINTF = /usr/bin/printf |
8 | |
9 | HTML_FILES := $(shell find mailpot-web/src/templates -type f -print0 | tr '\0' ' ') |
10 | PY_FILES := $(shell find . -type f -name '*.py' -print0 | tr '\0' ' ') |
11 | |
12 | .PHONY: check |
13 | check: |
14 | @$(CARGOBIN) check --all-features --all --tests --examples --benches --bins |
15 | |
16 | .PHONY: fmt |
17 | fmt: |
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 |
24 | lint: |
25 | @$(CARGOBIN) clippy --no-deps --all-features --all --tests --examples --benches --bins |
26 | |
27 | |
28 | .PHONY: test |
29 | test: check lint |
30 | @$(CARGOBIN) nextest run --all --no-fail-fast --all-features |
31 | |
32 | .PHONY: rustdoc |
33 | rustdoc: |
34 | @RUSTDOCFLAGS="--html-before-content ./.github/doc_extra.html" $(CARGOBIN) doc --workspace --all-features --no-deps --document-private-items |
35 | |
36 | .PHONY: rustdoc-open |
37 | rustdoc-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 |
41 | rustdoc-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 |
45 | rustdoc-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 |