#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

SHELL=/bin/sh

BUILDDIR = ./build

build: $(BUILDDIR)/build-stamp

-include debian/debiandirs

debian/debiandirs: admin/debianrules
	perl -w admin/debianrules echodirs > debian/debiandirs

$(BUILDDIR)/build-stamp: 
	dh_testdir
	if test ! -f configure; then \
	  $(MAKE) -f admin/Makefile.common ;\
	fi
	test -d $(BUILDDIR) || mkdir $(BUILDDIR) ;\
	cd $(BUILDDIR) ;\
	$$PWD/../configure $(configkde) --enable-static  \
		--without-libjpeg --without-libgif --without-libgdbm  \
		--without-audiofile \
		--libdir=/$(kde_libdir) --includedir=/$(kde_includedir)

	make -C $(BUILDDIR) TOPSUBDIRS="QwSpriteField uulib mimelib"

	touch $(BUILDDIR)/build-stamp

clean: debian-clean
	dh_clean
	-rm -f debian/debiandirs

debian-clean:
	dh_testdir
	-rm -rf $(BUILDDIR)
	if test -d CVS; then \
	  make -f admin/Makefile.common cvs-clean ;\
	fi


binary-indep:	checkroot build
	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: build
	dh_testdir
	dh_testroot
	dh_clean
	dh_installdirs

	make -C $(BUILDDIR) DESTDIR=`pwd`/debian/tmp install 
	perl -w admin/debianrules

	dh_undocumented
	dh_installdocs
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_movefiles -plibuulib-dev $(kde_includedir)/*uulib* $(kde_libdir)/libuulib*.so $(kde_libdir)/libuulib*.a
	dh_movefiles -plibmime-dev $(kde_includedir)/*mime* $(kde_libdir)/libmime*.so $(kde_libdir)/libmime*.a
	dh_movefiles -plibqwspritefield-dev $(kde_includedir)/*QwSpriteField* $(kde_libdir)/libQwSpriteField*.so $(kde_libdir)/libQwSpriteField*.a
	#dh_movefiles -plibodbc-dev $(kde_includedir)/*odbc* $(kde_libdir)/lib*odbc*.so $(kde_libdir)/lib*odbc*.a
	dh_movefiles -plibuulib5 $(kde_libdir)/libuu*
	dh_movefiles -plibqwspritefield1 $(kde_libdir)/libQwSpriteField* usr/share/doc/kdesupport/QwSpriteField/*
	#dh_movefiles -plibmime1 $(kde_libdir)/libmime* usr/share/doc/kdesupport/mimelib/*
	dh_fixperms
	dh_suidregister
	dh_makeshlibs -V
	dh_installdeb
	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	perl -w admin/debianrules update
	dh_builddeb

# Below here is fairly generic really

binary:		binary-indep binary-arch

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