#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/autoreconf.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

common-binary-post-install-arch:: list-missing
list-missing: remove-unwanted-files
remove-unwanted-files:
	rm -f debian/tmp/usr/lib/*.la
	rm -f debian/tmp/usr/lib/gobject-introspection/giscanner/*.pyc
	rm -f debian/tmp/usr/lib/gobject-introspection/giscanner/*.pyo

DEB_MAKE_ENVVARS += HOME=$(CURDIR)
DEB_MAKE_CHECK_TARGET = check

DEB_CONFIGURE_EXTRA_FLAGS += --enable-gtk-doc --enable-doctool
DEB_DH_MAKESHLIBS_ARGS_ALL += -V -- -c4

binary-install/gobject-introspection::
	dh_python2 -p$(cdbs_curpkg)

build/gobject-introspection:: debian/dh_girepository.1
debian/dh_girepository.1:: debian/dh_girepository
	pod2man -c "gobject-introspection" -r "$(DEB_VERSION)" $< $@

$(patsubst %,binary-predeb/%,$(DEB_ARCH_PACKAGES)) ::
	debian/gobject-introspection/usr/bin/dh_girepository -p$(cdbs_curpkg)

clean::
	rm -rf $(CURDIR)/.cache
	rm -f debian/dh_girepository.1
	find . -name '*.pyc' -delete
	# generated file not removed by make clean
	rm -f giscanner/scannerlexer.c
