#!/usr/bin/make -f

#export DH_VERBOSE=1
DPKG_EXPORT_BUILDTOOLS=1
-include /usr/share/dpkg/buildtools.mk
include /usr/share/dpkg/pkg-info.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
export DRACUT_MAIN_VERSION=$(DEB_VERSION_UPSTREAM_REVISION)
export DRACUT_FULL_VERSION=$(DEB_VERSION)

deb_systemdsystemunitdir = $(shell pkg-config --variable=systemdsystemunitdir systemd | sed s,^/,,)

%:
	dh $@ --with bash-completion

override_dh_auto_configure:
	dh_auto_configure -- --systemdsystemunitdir=/$(deb_systemdsystemunitdir) --libdir=/usr/lib --disable-dracut-cpio

override_dh_auto_install:
	dh_auto_install
	rm debian/tmp/usr/lib/dracut/modules.d/77dracut-systemd/*.adoc
	rm debian/tmp/usr/lib/dracut/modules.d/77dracut-systemd/*.8

override_dh_auto_test:
	make -C test check TESTS="80 81"
	make syncheck

override_dh_install:
	dh_install
	dh_install -pdracut-core $(deb_systemdsystemunitdir)
