#! /usr/bin/make -f

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

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

%:
	dh $@ --builddirectory=debian/build

# --libexecdir is set here because debhelper defaults to using multiarch
# paths at compat level 9, which is a reasonable choice in general but
# unnecessary here.
override_dh_auto_configure:
	dh_auto_configure -- --libexecdir=\$${prefix}/lib

# Slightly peculiar trick to allow installing the Upstart job only on some
# distributions without having to change its name or play tricks with
# symlinks.
ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
  INITNAME := --name=binfmt-support
endif

override_dh_installinit:
	dh_installinit $(INITNAME) --error-handler=true -- start 90 2 3 4 5 .
