# dev and build helper
# :-
# SPDX-FileCopyrightText: © 2026 Franz Glasner
# SPDX-License-Identifier: MIT
# :-

.PHONY: help all clean distclean dist export build tests flake8 doc clean-doc doc-html clean-doc-html doc-pdf clean-doc-pdf install-dev install-doc

help:
	@echo Targets: help, clean, distclean, export, dist, build, tests, doc clean-doc

all: tests flake8

build:
	python -m build

dist: distclean build

distclean: clean
	rm -rf dist/ *.egg-info

export:
	rm -rf __arch
	hg kwarchive __arch

clean:
	rm -rf __arch/
	find . -name '*.pyc' -delete

tests:
	-python -m unittest discover -s tests

flake8:
	-flake8 pygments_lexer_pseudocode2
	-flake8 tests

doc: doc-html doc-pdf

clean-doc:
	(cd docs && make clean)

doc-html:
	(cd docs && make html)

clean-doc-html:
	rm -rf docs/_build/html

doc-pdf:
	(cd docs && make latex)
	(cd docs/_build/latex && gmake)

clean-doc-pdf:
	rm -rf docs/_build/latex

install-dev:
	python -m pip install -r requirements-dev.txt

install-doc:
	python -m pip install -r requirements-docs.txt
	# Not needed any more because handled in docs/conf.py as hack
	#python -m pip install --editable .
