pac-man / Makefile 11 commits
17-11-2026
71 lines 1.8 kB
 1UV_VENV			:= .venv
 2UV				?= uv
 3CACHE_DIR		:= .cache
 4UV_CACHE_DIR	:= $(CACHE_DIR)/uv
 5UV_ENV			:= UV_CACHE_DIR=$(UV_CACHE_DIR) UV_PROJECT_ENVIRONMENT=$(UV_VENV)
 6
 7
 8PIP_VENV			:= .pip_venv
 9VENV_PY			:= $(PIP_VENV)/bin/python
10VENV_PIP		:= $(PIP_VENV)/bin/pip
11REQ_FILE		:= requirements.txt
12
13ARGS			?= config.json
14
15.PHONY: install run debug lint lint-strict uv-install uv-run uv-debug uv-lint uv-lint-strict py-install py-run py-debug py-lint py-lint-strict clean fclean
16
17run: uv-run
18install: uv-install
19debug: uv-debug
20lint: uv-lint
21lint-strict: uv-lint-strict
22
23uv-install:
24	$(UV_ENV) $(UV) sync
25
26uv-run:
27	$(UV_ENV) $(UV) run python -B pac-man.py $(ARGS)
28
29uv-debug:
30	$(UV_ENV) $(UV) run python -B -m pdb pac-man.py $(ARGS)
31
32uv-lint: clean
33	$(UV_ENV) $(UV) run flake8 .
34	$(UV_ENV) $(UV) run mypy . --warn-return-any --warn-unused-ignores --ignore-missing-imports --disallow-untyped-defs --check-untyped-defs
35
36uv-lint-strict: clean
37	$(UV_ENV) $(UV) run flake8 .
38	$(UV_ENV) $(UV) run mypy . --strict
39
40py-install: $(PIP_VENV)/.installed
41
42$(PIP_VENV)/.installed: $(REQ_FILE)
43	python3 -m venv $(PIP_VENV)
44	$(VENV_PIP) install -r $(REQ_FILE)
45	touch $@
46
47py-run: py-install
48	$(VENV_PY) -B pac-man.py $(ARGS)
49
50py-debug: py-install
51	$(VENV_PY) -B -m pdb pac-man.py $(ARGS)
52
53py-lint: clean py-install
54	$(VENV_PY) -B -m flake8 .
55	$(VENV_PY) -B -m mypy . --warn-return-any --warn-unused-ignores --ignore-missing-imports --disallow-untyped-defs --check-untyped-defs
56
57py-lint-strict: clean py-install
58	$(VENV_PY) -B -m flake8 .
59	$(VENV_PY) -B -m mypy . --strict
60
61clean:
62	find . -type d -name "__pycache__" -exec rm -rf {} +
63	find . -type d -name ".mypy_cache" -exec rm -rf {} +
64	find . -type d -name ".pytest_cache" -exec rm -rf {} +
65
66fclean: clean
67	rm -rf $(UV_VENV)
68	rm -rf $(PIP_VENV)
69	rm -rf $(CACHE_DIR)
70	rm -rf build
71	rm -rf dist