.PHONY: data train eval lib check check-ci

# Optional local settings (e.g. POKER_EVAL_DIR pointing to a C library already
# built elsewhere): `local.mk` is not required.
-include local.mk

# Passing arguments via ARGS= (e.g. make train ARGS=--fast).
# Never run `make train --fast`: make would interpret --fast as its own
# option and fail with exit 2.

data:
	python -m pokerlm build-data $(ARGS)

train:
	python -m pokerlm train $(ARGS)

eval:
	python -m pokerlm eval $(ARGS)

# 7-card C evaluator (eval/): builds `eval/libpokereval.so`, which
# `pokerlm.eval7_c` looks for via POKER_EVAL_DIR, then in `eval/`.
lib:
	$(MAKE) -C eval libpokereval.so

# Full gate: tests + replay of ALL the ```console``` blocks of docs/*.md.
# Blocks with `requires=<file>` are skipped (with a message) only if their
# file is missing: with the exported checkpoint (`python -m pokerlm
# export-weights`), the built corpus (`make data`) and a GPU, nothing is skipped.
# An explicit `tests/` rather than a bare `pytest`: keeps the scope stable.
check:
	pytest tests/ && python -m pokerlm check-docs

# Gate reproducible without a checkpoint, without a corpus and without a GPU
# (CI): everything except the `requires=…` blocks, which are skipped even if
# their files exist.
check-ci:
	pytest tests/ && python -m pokerlm check-docs --skip-requires
