#! /usr/bin/make -f
# Build the libtasn1 packages for Debian.

export DEB_CFLAGS_MAINT_APPEND := -Wall
export DEB_CXXFLAGS_MAINT_APPEND := -Wall

AMCONFBUILDINDEP := $(shell if dh_listpackages | grep -q libtasn1-doc ; \
        then echo "--enable-gtk-doc --enable-gtk-doc-pdf" ; \
        else echo "--disable-gtk-doc --disable-gtk-doc-pdf"; fi)

override_dh_auto_configure:
	dh_auto_configure --verbose -- \
	--disable-silent-rules \
	--enable-ld-version-script --with-packager=Debian \
	--with-packager-bug-reports=http://bugs.debian.org/ \
	--with-packager-version="$(DEB_VERSION)" \
	$(AMCONFBUILDINDEP)

override_dh_makeshlibs:
	dh_makeshlibs -V 'libtasn1-6 (>=4.1-0)'

override_dh_auto_build:
	dh_auto_build --verbose --parallel
ifeq ($(filter --disable-gtk-doc,$(AMCONFBUILDINDEP)),)
	if ! test -e doc/libtasn1.pdf ; then \
		$(MAKE) pdf ; fi
	if ! test -e doc/libtasn1.html ; then \
		$(MAKE) html ; fi
endif

override_dh_strip:
	dh_strip --dbg-package=libtasn1-6-dbg

override_dh_compress:
	dh_compress --exclude=libtasn1.pdf

%:
	dh $@ --parallel --with autotools_dev
