# Local build and checks. The real gate is `nix build .#site`, which runs the
# same steps in the sandbox and refuses to produce a non-conforming page.

SPEC_DESCRIPTION = The Mews Profile specification, version 0.1.

.PHONY: site test lint clean

site:
	rm -rf build
	mkdir -p build/spec build/dtd
	cp site/index.html site/about.html site/check.html build/
	cp mews-0.1.css build/mews-0.1.css
	cp mews-0.1.css build/spec/mews-0.1.css
	cp dtd/mews-0.1.dtd dtd/xhtml-mobile12.dtd build/dtd/
	uv run --script md2mews.py doc/SPEC.md -o build/spec/0.1.html --lang en \
		--variant mews-cool --description "$(SPEC_DESCRIPTION)"
	uv run mewslint.py --quiet build/index.html build/about.html build/check.html \
		build/spec/0.1.html
	@echo "site built in build/"

test:
	uv run --script dtd/check_dtd.py
	uv run pytest -q

lint:
	uv run ruff check .
	uv run ruff format --check .

clean:
	rm -rf build
