#!/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.
# tweaked by Stephen Kulow and Ivan Moore for use with KDE

BUILDDIR = ./build

build: build-stamp

export kde_prefix=`kde-config --prefix`
export kde_bindir=`kde-config --expandvars --exec-prefix`
export QTDIR=/usr/lib/qt3

configkde=--disable-debug --disable-rpath --prefix=$(kde_prefix) --libexecdir=$(kde_bindir) --with-qt-dir=$(QTDIR)

build-stamp:
	dh_testdir
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif
	if test ! -f configure; then \
	  $(MAKE) -f admin/Makefile.common ;\
	fi
	./configure $(configkde)
	make
	touch build-stamp

clean: debian-clean
	dh_clean
	rm -f `pwd`/kde/version.h
	rm -f `pwd`/debian/*~
	rm -rf `pwd`/debian/kde-style-klearlook

debian-clean:
	dh_testdir
	-rm -f build-stamp
	if test -d CVS; then \
	  make -f admin/Makefile.common cvs-clean ;\
	fi
	-make distclean
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	rm -f config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	rm -f config.guess
endif

binary-indep: build
	dh_testroot
	dh_testdir
# 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
	make install DESTDIR=`pwd`/debian/kde-style-klearlook/
	install -m 644 debian/Clearlooks.kcsrc \
		`pwd`/debian/kde-style-klearlook/usr/share/apps/kdisplay/color-schemes/
	dh_install
	dh_installdocs
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb       	

# Below here is fairly generic really

binary:		binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean
