#!/usr/bin/make -f

ACLOCAL = /usr/bin/aclocal-1.9
AUTOMAKE = /usr/bin/automake-1.9
ACLOCAL_OPTIONS = "-I config -I /usr/share/autoconf-archive/"

autogen: autogen-stamp
autogen-stamp:
	dh_testdir
	ACLOCAL=$(ACLOCAL) AUTOMAKE=$(AUTOMAKE) ACLOCAL_OPTIONS=$(ACLOCAL_OPTIONS) ./autogen.sh
	touch autogen-stamp

configure: configure-stamp
configure-stamp:
	dh_testdir
#	./configure --prefix=/usr/ --enable-tests --enable-perl --enable-python
	./configure --prefix=/usr/ --enable-tests
	touch configure-stamp

build: build-stamp
build-stamp: autogen-stamp configure-stamp 
	dh_testdir
	$(MAKE)
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f *-stamp
	-$(MAKE) clean
	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) check
	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install

binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_movefiles
	dh_installchangelogs 
	dh_installcron
	dh_link
	dh_compress
	dh_fixperms
	dh_makeshlibs -V 'libyandex-blackbox2 (>= 1.5), libyandex-blackbox2 (<< 1.6)'
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb
	dh_perl

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

