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

build:
	dh_testdir
	(       kde_htmldir=/usr/doc/kde/HTML \
		kde_appsdir=/usr/share/applnk \
		kde_icondir=/usr/share/icons \
		kde_sounddir=/usr/share/sounds \
		kde_datadir=/usr/share/apps \
		kde_locale=/usr/share/locale \
		kde_cgidir=/usr/lib/cgi-bin \
		kde_confdir=/etc/kde \
		kde_mimedir=/usr/share/mimelnk \
		kde_toolbardir=/usr/share/toolbar \
		kde_wallpaperdir=/usr/share/wallpaper \
		kde_bindir=/usr/X11R6/bin \
		kde_partsdir=/usr/lib/parts \
		CFLAGS="-O2 -Wall -g" \
		CXXFLAGS="-O2 -Wall -g" \
		 ./configure --prefix=/usr --enable-debug \
		  	     --disable-rpath \
		             --includedir="\$$(prefix)/include/kde" \
			     --libdir="\$$(prefix)/X11R6/lib" )
	make 

	touch build

clean:
	dh_testdir
	-rm -f build
	-make distclean
	-rm -f `find . -name "*~"`
	-rm -f */*.moc
	-rm -rf debian/tmp `find debian/* -type d ! -name CVS ` \
		debian/files* core 
	-rm -f debian/*substvars debian/*shlibs*
	-rm -f config.log libtool config.status config.cache

binary-indep:	build
	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
	dh_installdirs
	make prefix=`pwd`/debian/tmp/usr \
	   kde_htmldir="`pwd`/debian/tmp/usr/doc/kde/HTML" \
	   kde_appsdir="`pwd`/debian/tmp/usr/share/applnk" \
	   kde_icondir="`pwd`/debian/tmp/usr/share/icons" \
	   kde_sounddir="`pwd`/debian/tmp/usr/share/sounds" \
	   kde_datadir="`pwd`/debian/tmp/usr/share/apps" \
	   kde_locale="`pwd`/debian/tmp/usr/share/locale" \
	   kde_cgidir="`pwd`/debian/tmp/usr/lib/cgi-bin" \
	   kde_confdir="`pwd`/debian/tmp/etc/kde" \
	   kde_mimedir="`pwd`/debian/tmp/usr/share/mimelnk" \
	   kde_toolbardir="`pwd`/debian/tmp/usr/share/toolbar" \
	   kde_wallpaperdir="`pwd`/debian/tmp/usr/share/wallpaper" \
	   kde_bindir="`pwd`/debian/tmp/usr/X11R6/bin" \
	   kde_partsdir="`pwd`/debian/tmp/usr/lib/parts" \
	   kde_confdir="`pwd`/debian/tmp/etc/kde" install 

	chmod a+x debian/kderules
	debian/kderules

	dh_movefiles
	dh_installdocs
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_suidregister
	dh_makeshlibs -V "kdelibs0g (>= 2:980419)" -m0
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb -v

# Below here is fairly generic really

binary:		binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean
