#!/usr/bin/make -f
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.

include /usr/share/dpatch/dpatch.make

DEB_BUILD_ARCH:=$(shell dpkg --print-installation-architecture)

ifeq ($(DEB_BUILD_ARCH),hurd-i386)
	CONFIG_OPTS:=--disable-threads
else
	CONFIG_OPTS:=
endif

export DH_COMPAT=4

# Uncomment this to turn on verbose mode. 
#export DH_VERBOSE=1

build: patch build-stamp
build-stamp:
	dh_testdir
	
	# First build the shared library
	./configure $(CONFIG_OPTS) --enable-cplusplus --disable-dependency-tracking\
		--with-tags=CXX --prefix=/usr --mandir=\$${prefix}/share/man\
		--sysconfdir=/etc --localstatedir=/var/lib\
		--datadir=\$${prefix}/share/doc
	$(MAKE)
	touch build-stamp

clean: clean-patched unpatch

clean-patched:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp

	# Add here commands to clean up after the build process.
	-$(MAKE) distclean

	dh_clean

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k

	#$(MAKE) check
	# Add here commands to install the package into debian/tmp.
	$(MAKE) install DESTDIR=`pwd`/debian/tmp
	touch install-stamp

# Build architecture-independent files here.
binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_link
	dh_installdocs
	dh_installchangelogs doc/README.changes
	dh_install --sourcedir=debian/tmp
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

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