#!/usr/bin/make -f

# $Id: rules,v 1.1 1999/04/03 05:01:33 roderick Exp $

dt	:= debian/tmp
prefix	= `pwd`/$(dt)

# Setting PREFIX at Makefile generation time loses because it might or
# might not match *perl*.  If it does the resulting hierarchy is wrong.
# So, set it at install time, after the structure of the hierarchy has
# been determined.  Since I have to add variables at install time anyway
# I set them all there.

build:
	dh_testdir
	perl Makefile.PL
	$(MAKE)
	$(MAKE) test

clean:
	dh_testdir
	dh_testroot
	[ ! -f Makefile ] || $(MAKE) realclean
	dh_clean

binary-indep: build
#	dh_testversion
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) \
		PREFIX=$(prefix)/usr \
		INSTALLMAN1DIR=$(prefix)/usr/man/man1 \
		INSTALLMAN3DIR=$(prefix)/usr/man/man3 \
	    pure_perl_install

	find $(prefix)/usr/lib -name .packlist -print0 | xargs -0r rm
	find $(prefix)/usr/lib -depth -type d -print0 | \
	    xargs -0r rmdir --ignore-fail-on-non-empty

	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installemacsen
#	dh_installinit
	dh_installcron
	dh_installmanpages
#	dh_undocumented
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_suidregister
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol -u -isp
#	dh_makeshlibs
	dh_md5sums
	dh_builddeb

binary-arch: build

binary: binary-indep binary-arch

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