#!/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) ;\
	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/wallpapers \
	kde_bindir=/usr/X11R6/bin \
	kde_partsdir=/usr/lib/parts \
	CFLAGS="-O2 -Wall -Wno-uninitialized -g" \
	CXXFLAGS="-O2 -Wall -Wno-uninitialized -g" \
	../configure --prefix=/usr --enable-debug \
	--disable-rpath \
	--includedir=/usr/include/kde \
	--libdir=/usr/X11R6/lib  
	
	make -C $(BUILDDIR)

	touch $(BUILDDIR)/build-stamp

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

clean: debian-clean
	-rm -rf $(BUILDDIR)
	dh_clean -k

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 -C $(BUILDDIR) 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" \
	   includedir=`pwd`/debian/tmp/usr/include/kde \
	   libdir=`pwd`/debian/tmp/usr/X11R6/lib install 

	perl -w debian/kderules 
	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
	dh_builddeb -v
	
# Below here is fairly generic really

binary:		binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean
