#!/usr/bin/make -f

# Enable the test suite.
export AUTHOR_TESTING = 1

# Get the package name and version.
include /usr/share/dpkg/pkg-info.mk

%:
	dh $@

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	prove -vr t/
endif

override_dh_auto_install:
	rsync -C --recursive --links --perms --times --delete	\
	    --exclude debian --exclude t --exclude .gitignore	\
	    $(CURDIR)/ debian/$(DEB_SOURCE)
	mkdir -p debian/$(DEB_SOURCE)/usr/share/man/man1
	set -e; for script in $$(ls usr/bin); do			\
	    pod2man --release=$(DEB_VERSION) --section 1		\
		--center="eyrie-utilities" usr/bin/$${script}		\
		> debian/$(DEB_SOURCE)/usr/share/man/man1/$${script}.1;	\
	done
	mkdir -p debian/$(DEB_SOURCE)/usr/share/man/man8
	set -e; for script in $$(ls usr/sbin); do			\
	    pod2man --release=$(DEB_VERSION) --section 8		\
		--center="eyrie-utilities" usr/sbin/$${script}		\
		> debian/$(DEB_SOURCE)/usr/share/man/man8/$${script}.8;	\
	done

override_dh_auto_clean:
	rm -rf usr/share
