#!/usr/bin/make -f
#export DH_VERBOSE=1

export DH_COMPAT=3

clean:
	dh_testdir
	dh_testroot
	-rm -f configure-stamp
	-rm -f build-stamp
	-$(MAKE) distclean
	dh_clean

configure: configure-stamp
configure-stamp:
	dh_testdir
	./configure --prefix=/usr --mandir=/usr/share/man
	touch configure-stamp

build: configure build-stamp
build-stamp:
	dh_testdir
	$(MAKE)
	touch build-stampclean:

install: build
	dh_clean -k
	dh_installdirs
	$(MAKE) install prefix=`pwd`/debian/koth/usr mandir=`pwd`/debian/koth/usr/share/man
	mv `pwd`/debian/koth/usr/bin/k{oth,oths,clever-ai,moron-ai} \
		`pwd`/debian/koth/usr/games
	install -m 644 src/koth.cfg debian/koth/etc/koth

binary-indep: install

binary-arch: install
	dh_testdir
	dh_installdocs
	dh_installmenu
	#dh_installmanpages
	dh_installchangelogs ChangeLog
	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 install install-arch install-indep
