#!/usr/bin/make -f

%:
	dh $@ --buildsystem=autoconf

override_dh_autoreconf:
	dh_autoreconf ./autogen.sh

execute_after_dh_auto_build:
	help2man --include=debian/swig.man --help-option=-help --version-option=-version ./swig > debian/swig.1
	help2man --include=debian/ccache-swig.man --help-option=-h --version-option=-V ./CCache/ccache-swig > debian/ccache-swig.1

# This is a workaround while we make the unit tests work in a reasonable way
override_dh_auto_test:

docdir = debian/swig/usr/share/doc/swig
execute_after_dh_installdocs-arch:
	mv $(docdir)/CHANGES $(docdir)/changelog
	mv $(docdir)/CHANGES.current $(docdir)/NEWS

override_dh_compress:
	dh_compress -Xswig-examples/examples

examples_dir = debian/swig-examples/usr/share/doc/swig-examples/examples

execute_after_dh_installdeb:
	rm -rf $(examples_dir)/test-suite
	if [ -f $(examples_dir)/Makefile ] ; then	\
	    sed -i -e 's/^ROOT_DIR =.*/ROOT_DIR = ./'	\
	        $(examples_dir)/Makefile ; 		\
	fi
