#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

# This is the debhelper compatability version to use.
export DH_COMPAT=3

build: build-stamp
build-stamp:
	dh_testdir

	./configure --prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--sysconfdir=/etc \
		$(DDEBUG) \
		$(DTRACE) \
		--disable-dmalloc
	$(MAKE)

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

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

	-rm -f config.{log,status}

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

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

	dh_movefiles

	#make -dbg package

	-$(MAKE) clean

	./configure --enable-debug --enable-trace \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--sysconfdir=/etc \
		--enable-mem-trace \
		--disable-dmalloc
	$(MAKE)

	$(MAKE) install DESTDIR=`pwd`/debian/tmp/

	mkdir -p debian/libzorpll-dbg/usr/lib/debug
	for l in `find debian/tmp/usr/lib -name '*.so*'`; do \
		cp -vdf $$l debian/libzorpll-dbg/usr/lib/debug/; \
	done

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a 
	dh_installchangelogs -a
	dh_link -a

	dh_strip -a -Nlibzorpll-dbg

	dh_compress -a
	dh_fixperms -a
	# You may want to make some executables suid here.
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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