#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatability version to use.
export DH_COMPAT=1

build: build-stamp
build-stamp:
	dh_testdir

	# Add here commands to compile the package.
	../configure --prefix=/usr --srcdir=`pwd`/..
	$(MAKE) 

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

	# Add here commands to clean up after the build process.
	-$(MAKE) distclean

	dh_clean

install: build 
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs


arch-indep-files=$(shell cd ../share-dir/wdinfo ; find .  -not -type d -not -name '*,D')

# Build architecture-independent files here.
binary-indep: build install
	dh_installdirs /usr/share/wdinfo
# Install the database
	export h=`pwd` ; cd ../share-dir/wdinfo ; for f in $(arch-indep-files) ; do echo $$f ; done | cpio -p -d -L $$h/debian/tmp/usr/share/wdinfo 
# Make the symbolic links
	awk -f ../share-dir/make-symlinks.awk -v datadir=./debian/tmp/usr/share ../share-dir/symlinks
# install the localisation stuff
	cp -R ../build/share/locale debian/tmp/usr/share


# Build architecture-dependent files here.
binary-arch: build install
#	dh_testversion
	dh_testdir
	dh_testroot
#	dh_installdebconf	
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installemacsen
#	dh_installpam
#	dh_installinit
	dh_installcron
	dh_install src/wday /usr/bin
	dh_installman  ../doc/wday.1 ../doc/wdinfo.5
	dh_installinfo ../build/doc/wday.info
#	dh_undocumented
	dh_installchangelogs 
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
