#!/usr/bin/make -f

export DH_VERBOSE=1

include /usr/share/dpkg/architecture.mk

%:
	dh $@ --without autoreconf

override_dh_auto_configure:
	dh_update_autotools_config
	# upstream autotools stuff is old enough to miss --runstatedir option and break debhelper(>10)
	# dh_auto_configure -- --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --libdir=\$${prefix}/lib
	./configure --infodir=\${prefix}/share/info --disable-option-checking --disable-silent-rules --libdir=\${prefix}/lib/$(DEB_HOST_MULTIARCH) --disable-dependency-tracking \
		--prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --libdir=\$${prefix}/lib --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)

override_dh_auto_install:
	dh_auto_install
	( cd $(CURDIR)/debian/autodir/usr/lib/autodir && rm -f *.a *.la )

override_dh_auto_clean:
	dh_auto_clean

override_dh_installinit:
	dh_installinit --name=autodir autodir.init

override_dh_installsystemd:
	dh_installsystemd --name=autodir-home autodir-home.service
	dh_installsystemd --name=autodir-group autodir-group.service
	dh_installsystemd --name=autodir autodir.service
