#! /usr/bin/make -f
# -*-makefile-*-
# debian/rules file for libmodem-vgetty-perl

PERL ?= /usr/bin/perl

package	:= $(shell sed -ne 's/^Package: *//p' debian/control)
destdir	:= $(CURDIR)/debian/$(package)

version	:= $(shell dpkg-parsechangelog | \
			sed -ne 's/^Version: *\([0-9]\+:\)*//p')

build:	build-indep build-arch
build-arch: build-stamp
build-indep: build-stamp
build-stamp:
	dh_testdir
	$(PERL) Makefile.PL INSTALLDIRS=vendor PERL=$(PERL)
	$(MAKE) LD_RUN_PATH=
	touch $@

clean:	checkroot
	rm -f build-stamp
	[ ! -f Makefile ] || $(MAKE) distclean
	dh_clean

binary-indep:	checkroot build
	dh_clean
	dh_installdirs

	$(MAKE) pure_install DESTDIR=$(destdir)

	dh_installdocs README
	dh_installexamples examples/answering_machine.pl  examples/callme.pl
	dh_installchangelogs ChangeLog
	dh_compress
	dh_fixperms
	dh_perl
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch:	checkroot build

binary:	binary-indep binary-arch

checkroot:
	dh_testdir
	dh_testroot

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