Makefile (1466B)
1 APP_NAME := patina-updater 2 3 # A throwaway config and data dir, so screenshots and test runs never touch the settings of a copy 4 # the user is running. 5 SCRATCH_ENV := XDG_CONFIG_HOME=$(CURDIR)/target/scratch-config XDG_DATA_HOME=$(CURDIR)/target/scratch-data 6 7 .DEFAULT_GOAL := help 8 9 .PHONY: help run build test check screenshot clean 10 11 help: ## Show this help 12 @echo "Usage: make <target>" 13 @echo 14 @awk 'BEGIN { FS = ":.*## " } /^[a-z-]+:.*## / { printf " \033[1m%-14s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) 15 16 run: ## Run on the mock (a fake system and a fake update), in a window 17 @mkdir -p target/scratch-config target/scratch-data 18 $(SCRATCH_ENV) PATINA_UPDATER_MOCK=1 cargo run 19 20 build: ## Build a release binary 21 cargo build --release 22 23 test: ## Run the tests (the app's, and the root helper's image-name rule against the app's) 24 cargo test 25 bash tests/helper-rule.sh ../linux/system/usr/libexec/patina-update 26 27 check: test ## Run the tests and clippy, as before a commit 28 cargo clippy --all-targets -- -D warnings 29 cargo fmt --check 30 31 screenshot: ## Regenerate docs/screenshot-*.png from the mock (needs a desktop) 32 @rm -rf target/scratch-config target/scratch-data 33 @mkdir -p docs target/scratch-config target/scratch-data 34 for s in available working switch done failed unreachable; do \ 35 $(SCRATCH_ENV) PATINA_UPDATER_MOCK=1 PATINA_UPDATER_DEMO=$$s PATINA_UPDATER_SCREENSHOT=docs/screenshot-$$s.png cargo run; done 36 37 clean: ## Remove build output 38 cargo clean