.PHONY: html clean install

SAMPLES=modpipe.conf ../COPYING
SPHINX=../int/runscript.sh sphinx-build
docdir=/usr/share/doc/modpipe

html: html/index.html

modobjects.inv:
	./make_sphinx_modeller.py > $@

html/index.html: *.rst modules/*.rst conf.py modobjects.inv ${SAMPLES}
	${SPHINX} -a -E -b html . html
	cp ${SAMPLES} html

install: html
	mkdir -p ${docdir}
	mkdir -p ${docdir}/_sources ${docdir}/_static ${docdir}/_images
	mkdir -p ${docdir}/modules ${docdir}/_sources/modules
	install html/*.html html/*.js ${SAMPLES} ${docdir}
	install html/modules/*.html ${docdir}/modules
	install html/_sources/*.txt ${docdir}/_sources
	install html/_sources/modules/*.txt ${docdir}/_sources/modules
	install html/_static/* ${docdir}/_static
	install html/_images/* ${docdir}/_images

clean:
	rm -rf html modobjects.inv
