#!/usr/bin/make -f

PACKAGE = $(shell dh_listpackages)
TMP     = $(CURDIR)/debian/$(PACKAGE)
MANDIR  = $(TMP)/usr/share/man/man3

%:
	dh $@ --with bash-completion

override_dh_auto_install:
	dh_auto_install
	rm --verbose $(MANDIR)/Rex::Resource::Common.3pm
	mkdir -p $(TMP)/usr/share/zsh/vendor-completions/
	mv --verbose \
        $(TMP)/usr/share/perl5/auto/share/dist/Rex/rex-tab-completion.zsh \
        $(TMP)/usr/share/zsh/vendor-completions/_rex
	rm --verbose -rf $(TMP)/usr/share/perl5/auto
