#!/usr/bin/make -f
# Original version Copyright by Ian Jackson.

SHELL+= -e

#export DH_VERBOSE=1

build:
	$(checkdir)
	make whois mkpasswd \
		OPTS="-O2 -g -DCONFIG_FILE=\\\"/etc/whois.conf\\\"" \
		HAVE_LIBIDN=1
	touch build

clean:
	$(checkdir)
	-rm -f build
	-make distclean
	-cd debian && rm -rf tmp files* substvars *debhelper

binary-arch: checkroot build
	$(checkdir)
	-rm -rf debian/tmp

	dh_installdirs usr/bin
	install whois mkpasswd debian/tmp/usr/bin/
	cd po && make install BASEDIR=../debian/tmp
	dh_installman whois.1 mkpasswd.1
	dh_installdocs README
	dh_installchangelogs 
	dh_strip
	dh_compress
	dh_fixperms
	dh_shlibdeps
	dh_gencontrol
	dh_installdeb
	dh_builddeb

define checkdir
	test -f debian/rules
endef

binary: binary-arch

checkroot:
	test root = "`whoami`"

.PHONY: binary binary-arch binary-indep clean checkroot
