#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# the newly created binary is needed for the test-suite, so put it on the path
# I actually only want to do this while running the test-suite, but I can't
# figure out how to do that in a Makefile
export PATH:=${PATH}:$(shell pwd)/bin

%:
	dh ${@}

override_dh_auto_clean:
	dh_auto_clean
	make -C tests clean
	make -C docs clean

override_dh_auto_build:
	# Build the documentation (upstream has no make targets for this)
	pdflatex --output-directory docs docs/pasdoc.tex
	latex2html -split 0 -dir docs docs/pasdoc.tex

	dh_auto_build
	# Use the help from the binary to create a man page as none is supplied.
	help2man --output=pasdoc.1 --name="documentation tool for Pascal source code" \
		 --no-info bin/pasdoc

override_dh_auto_test:
	# There are more tests possible and the latex versions are not really
	# checked yet as the non validate_ tests will not fail.
	# Also disable validate_html for now as it takes extremely long and needs a
	# working network connection. Have to figure out how to fix that.
	make -C tests html htmlhelp simplexml latex latex2rtf validate_simplexml #validate_html
