#!/usr/bin/make -f

# output every command that modifies files on the build system.
export DH_VERBOSE=1
# switch on verbose pybuild output
export PYBUILD_VERBOSE=1

export PYBUILD_NAME=lark

export LANG=C.UTF-8
export LC_ALL=C.UTF-8

%:
	dh $@ --with python3,mkdocs --buildsystem=pybuild

override_dh_auto_clean:
	dh_auto_clean
	rm -rf html lark_parser.egg-info

override_dh_auto_build:
	dh_auto_build
	mkdocs build -d $(CURDIR)/html
	find $(CURDIR)/html -type f -name sitemap.xml.gz -delete
	# Remove IDE for the time being. It uses js and css code from CDNs.
	# This code is not yet available in the Debian archive.
	rm -rf $(CURDIR)/html/ide

override_dh_auto_install:
	dh_auto_install
	# Patch out bundled jquery.js
	rm html/js/jquery-2.1.1.min.js
	ln -s /usr/share/javascript/jquery/jquery.js html/js/jquery-2.1.1.min.js
