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

$(BUILDDIR)/build-stamp:
	dh_testdir
	if test ! -f configure; then \
	  $(MAKE) -f admin/Makefile.common ;\
	fi
	test -d $(BUILDDIR) || mkdir $(BUILDDIR) ;\
	cd $(BUILDDIR) ;\
	CFLAGS="-O2 -g -Wall -Wno-uninitialized -D_REENTRANT" \
	CXXFLAGS="-O2 -g -Wall -Wno-uninitialized -D_REENTRANT" ; \
	../configure --prefix=/usr --enable-static \
				--with-qt-dir=/usr/lib/qt1g \
				--without-libjpeg \
		 		--without-libgif \
				--without-libgdbm 
			        --includedir="\$$(prefix)/include/kde" && \
	make -C $(BUILDDIR) TOPSUBDIRS="QwSpriteField uulib mimelib"

	touch $(BUILDDIR)/build-stamp

clean: debian-clean
	-rm -rf $(BUILDDIR)
	-rm -f debian/files
	-rm -f debian/*substvars
	-rm -f configure
	-rm -f debian/mailcap
	dh_clean -k

debian-clean:
	dh_testdir
	-rm -f $(BUILDDIR)/build

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 -k
	dh_installdirs

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

	dh_movefiles
	dh_installdocs
	dh_installchangelogs 
	dh_strip
	dh_compress
	dh_fixperms
	dh_suidregister
	dh_makeshlibs -V
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	perl admin/debianrules update
	dh_builddeb

# Below here is fairly generic really

binary:		binary-indep binary-arch

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