# 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
	cd site && uv run pelican content
	cp site/output/*.html build/
	cp site/output/mews-0.1.css build/mews-0.1.css
	cp spec/mews-0.1.css build/spec/mews-0.1.css
	cp spec/mews-0.1.dtd spec/xhtml-mobile12.dtd build/dtd/
	uv run --script quickstart/md2mews.py spec/SPEC.md -o build/spec/0.1.html \
		--lang en --variant mews-cool --description "$(SPEC_DESCRIPTION)"
	uv run mewslint --quiet build/*.html build/spec/0.1.html
	@echo "site built in build/"

test:
	uv run --script spec/check_dtd.py
	cd validator && uv run pytest -q
	cd directory && uv run pytest -q
	uv run pytest -q

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

clean:
	rm -rf build site/output
