#!/usr/bin/make -f

DEB_AUTO_UPDATE_LIBTOOL = pre
DEB_AUTO_UPDATE_ACLOCAL = ,
DEB_AUTO_UPDATE_AUTOCONF = ,
DEB_AUTO_UPDATE_AUTOHEADER = ,
DEB_AUTO_UPDATE_AUTOMAKE = ,
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk

stem = $(DEB_SOURCE_PACKAGE)
lib = lib$(stem)
major = 0
pkg-lib = lib$(stem)$(major)
pkg-dev = lib$(stem)$(major)-dev

# Multiarch quirk (see also other uses of that variable in this file)
DEB_CONFIGURE_EXTRA_FLAGS += --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)

# bootstrap autotools files (CDBS normally only updates them)
DEB_MAKE_CLEAN_TARGET = distclean
DEB_AUTOMAKE_ARGS = --add-missing --copy
clean::
	rm -f Makefile.in aclocal.m4 compile config.guess config.h.in config.sub configure depcomp install-sh ltmain.sh missing test-driver

DEB_MAKE_CHECK_TARGET = check

DEB_INSTALL_MANPAGES_jbig2dec = debian/tmp/usr/share/man/man1/*

DEB_SHLIBDEPS_LIBRARY_$(pkg-lib) = $(lib)
DEB_DH_MAKESHLIBS_ARGS = -Pdebian/$(cdbs_curpkg)

# Let d-shlibs resolve dependencies for and install library files
binary-post-install/$(pkg-lib) binary-post-install/$(pkg-dev):: \
 debian/stamp-local-shlibs-$(lib)
debian/stamp-local-shlibs-$(lib): \
 binary-install/$(pkg-lib) \
 binary-install/$(pkg-dev)
	d-shlibmove --commit \
		--exclude-la \
		--multiarch \
		--movedev "debian/tmp/usr/include/*" usr/include/ \
		debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/$(lib).so
	touch $@
clean::
	rm -f debian/stamp-local-shlibs-$(lib)
