#!/usr/bin/make -f

DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
# Take account of old dpkg-architecture output.
ifeq ($(DEB_HOST_ARCH_OS),)
  DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
  ifeq ($(DEB_HOST_ARCH_OS),gnu)
    DEB_HOST_ARCH_OS := hurd
  endif
endif

ifeq ($(DEB_HOST_ARCH_OS),linux)
DMIDECODE := dmidecode-udeb (>= 2.7)
endif

build:
	dh_testdir

clean:
	dh_testdir
	dh_testroot
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdebconf
	dh_install debian/isinstallable DEBIAN
	dh_installdeb
	dh_fixperms
ifdef DMIDECODE
	dh_gencontrol -- -V'dmidecode=$(DMIDECODE)'
else
	dh_gencontrol
endif
	dh_builddeb

binary-indep: build install

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