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


BUILDDIR = ./build

tmp = debian/tmp
overrides = $(tmp)/usr/share/lintian/overrides

build: build-stamp

-include debian/debiandirs

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

build-stamp:
	dh_testdir
	if test ! -f configure; then \
	  $(MAKE) -f admin/Makefile.common ;\
	fi
	./configure $(configkde)
	$(MAKE)
	touch build-stamp

clean: debian-clean
	dh_clean

debian-clean:
	dh_testdir
	-rm -f build-stamp
	if test -d CVS; then \
	  $(MAKE) -f admin/Makefile.common cvs-clean ;\
	fi
	-$(MAKE) distclean

binary-indep: build
	dh_testroot
	dh_testdir

binary-arch: build
	dh_testdir
	dh_testroot
	dh_clean -k
	install -d $(tmp)/etc/kde2
	install -d $(overrides)
	-cp debian/*.override $(overrides)
	-for i in `ls $(overrides)/`; do \
	  mv $(overrides)/$$i \
	    $(overrides)/`echo $$i | sed -e 's#.override##'`; \
	done
	$(MAKE) install DESTDIR=`pwd`/$(tmp)/
	perl -w admin/debianrules cleanup

	for i in `find debian/ -type l -name "common"`; do \
		rm $$i; \
		ln -s ../common $$i ;\
	done
	dh_undocumented
	dh_movefiles -a
	dh_installdocs -a
	dh_installmenu -a
	dh_installmime -a
	dh_installchangelogs -pkbabel kbabel/ChangeLog
	dh_installchangelogs -pkbabel-dev kbabel/ChangeLog
	dh_installchangelogs -pkmtrace
	dh_installchangelogs -pkstartperf
	dh_installchangelogs -pkdesdk-scripts
	dh_link -a
	dh_strip -a
	dh_perl -a
	dh_link -a
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -V -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

# Below here is fairly generic really

binary:		binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean

