#!/usr/bin/make -f
# ----------------------------------------------------------------------------
# - rules                                                                    -
# - debian rules for afnix                                                   -
# ----------------------------------------------------------------------------
# - This program is  free software;  you can  redistribute it and/or  modify -
# - it provided that this copyright notice is kept intact.                   -
# -                                                                          -
# - This  program  is  distributed in the hope  that it  will be useful, but -
# - without  any   warranty;  without  even   the   implied    warranty   of -
# - merchantability  or fitness for a particular purpose. In not event shall -
# - the copyright holder be  liable for  any direct, indirect, incidental or -
# - special damages arising in any way out of the use of this software.      -
# ----------------------------------------------------------------------------
# - copyright (c) 1999-2019 amaury darsch                                    -
# ----------------------------------------------------------------------------

# enable dh verbose mode
#export DH_VERBOSE=1
# extract multiarch
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# install dh rules
%:
	dh $@

# rule: configure
# configure the distribution
override_dh_auto_configure:
	./cnf/bin/afnix-setup -o --package=deb \
	--prefix=$(CURDIR)/debian/tmp --altdir=$(CURDIR)/debian/tmp \
        --pkgbin=/usr/bin --pkglib=/usr/lib/$(DEB_HOST_MULTIARCH) \
        --pkgdoc=/usr/share/doc/afnix --pkgwww=/var/www/afnix -v

# rule: install
# install the distribution - publish documentation before installing
override_dh_install:
	dh_auto_install -- publish
	dh_install

# rule: clean
# clean the whole distribution
override_dh_clean:
	$(MAKE) reset
	dh_clean

