#!/usr/bin/make -f
# -*- makefile -*-
#export DH_VERBOSE=1

INSTALL_DIR = $(CURDIR)/debian/dub/

%:
	dh $@

override_dh_auto_build:
	$(CURDIR)/debian/build_dub.sh

	# create manual pages
	cd $(CURDIR)/bin/ && ./dub $(CURDIR)/scripts/man/gen_man.d

override_dh_install:
	dh_install

	# install shell completions
	mkdir -p $(INSTALL_DIR)//usr/share/bash-completion/completions/
	cp $(CURDIR)/scripts/bash-completion/dub.bash $(INSTALL_DIR)/usr/share/bash-completion/completions/dub
	mkdir -p $(INSTALL_DIR)/usr/share/fish/completions/
	cp $(CURDIR)/scripts/fish-completion/dub.fish $(INSTALL_DIR)/usr/share/fish/completions/

override_dh_auto_clean:
	dh_auto_clean
	rm -f $(CURDIR)/scripts/man/*.1

override_dh_missing:
	dh_missing --fail-missing
