#!/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

version = $(shell dpkg-parsechangelog | \
		  awk -F ': ' '$$1 == "Version" { print $$2; exit }')

dtmp = $(CURDIR)/debian/binfmt-support

build:

clean:
	dh_testdir
	dh_testroot
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	sed 's/@VERSION@/$(version)/g' update-binfmts.pl \
		> $(dtmp)/usr/sbin/update-binfmts
	chmod 755 $(dtmp)/usr/sbin/update-binfmts
	install -m755 run-detectors.pl \
		$(dtmp)/usr/share/binfmt-support/run-detectors
	install -m644 Binfmt/*.pm \
		$(dtmp)/usr/share/perl5/Binfmt/

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installinit --error-handler=true -- start 90 2 3 4 5 .
	dh_installman
	dh_installchangelogs 
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_perl
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install

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