# Minimal Makefile for building the HADDOCK3 Sphinx documentation.
# Run from within docs/: `make html`.
#
# docs/ is the Sphinx source root. docs/pages/ holds hand-authored content,
# docs/src/ holds content generated by sphinx-apidoc / build_defaults_rst.py.
# Everything else directly in docs/ (this Makefile, README.md, conf.py,
# build_defaults_rst.py, titles.yaml) is build tooling and is excluded from
# the built site (see exclude_patterns in conf.py).

SPHINXBUILD  ?= sphinx-build
SPHINXAPIDOC ?= sphinx-apidoc
SOURCEDIR    = .
GENDIR       = src
BUILDDIR     = ../haddock3-docs
APIDOCSRC    = ../src/haddock

.PHONY: help apidoc html linkcheck clean

help:
	@echo "make html       - regenerate API doc stubs and build the HTML docs"
	@echo "make apidoc     - regenerate API .rst stubs only"
	@echo "make linkcheck  - check for broken links"
	@echo "make clean      - remove the built HTML output"

apidoc:
	$(SPHINXAPIDOC) -f -e -o $(GENDIR) $(APIDOCSRC) -d 1

html: apidoc
	$(SPHINXBUILD) -b html $(SOURCEDIR) $(BUILDDIR)

linkcheck:
	$(SPHINXBUILD) -b linkcheck $(SOURCEDIR) $(BUILDDIR)/linkcheck

clean:
	rm -rf $(BUILDDIR)
