#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@

override_dh_auto_build:
	make -f unix.mak

override_dh_auto_install:
	mv passwordmaker debian/passwordmaker-cli/usr/bin


DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^+]+).*,\1,p')
get-orig-source:
	uscan --noconf --force-download --rename --download-current-version --destdir=.
	rm -rf passwordmaker-cli-$(DEB_UPSTREAM_VERSION)
	tar -xf passwordmaker-cli_$(DEB_UPSTREAM_VERSION).orig.tar.gz
	rm passwordmaker-cli_$(DEB_UPSTREAM_VERSION).orig.tar.gz
	rm passwordmaker-cli-$(DEB_UPSTREAM_VERSION)/*.exe 
	rm passwordmaker-cli-$(DEB_UPSTREAM_VERSION)/*.dll
	rm -r passwordmaker-cli-$(DEB_UPSTREAM_VERSION)/shared/3rdparty
	mv passwordmaker-cli-$(DEB_UPSTREAM_VERSION) passwordmaker-cli-$(DEB_UPSTREAM_VERSION).orig
	GZIP=--best tar -cz --owner root --group root --mode a+rX \
			-f passwordmaker-cli_$(DEB_UPSTREAM_VERSION)+dfsg.orig.tar.gz \
			passwordmaker-cli-$(DEB_UPSTREAM_VERSION).orig
	rm -r passwordmaker-cli-$(DEB_UPSTREAM_VERSION).orig
