#!/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

export QTDIR=/usr/share/qt3

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

all: build

config.status: configure
	dh_testdir
	chmod +x debian/my_mv
	debian/my_mv config.guess config.guess.old
	debian/my_mv config.sub   config.sub.old
	ln -s /usr/share/misc/config.sub .
	ln -s /usr/share/misc/config.guess .

	# Add here commands to configure the package.
	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --with-qt=/usr/share/qt3

build: build-stamp

build-stamp:  config.status
	dh_testdir
	$(MAKE)
	txt2man -s 1 -t mysqlcc < debian/manpages/mysqlcc.in > debian/mysqlcc.1
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	chmod +x debian/my_mv
	debian/my_mv -f config.sub.old   config.sub
	debian/my_mv -f config.guess.old config.guess
	rm -f build-stamp config.status config.log mysqlcc.pro Makefile install debian/mysqlcc.1 mysqlcc
	rm -rf tmp moc

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

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/mysqlcc.
	# $(MAKE) install prefix=$(CURDIR)/debian/mysqlcc/usr


# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_install -i
	dh_link -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_shlibdeps -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installchangelogs -a Changelog.txt
	dh_installdocs -a
	dh_install -a
	dh_installmenu -a
	dh_installman -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	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 
