#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

export DH_VERBOSE=1

PKG_DIR = debian/gtkhash
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export HOME = $(CURDIR)/debian/build

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


%:
	dh $@ --with autoreconf


# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
#	dh_auto_configure -- #	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_auto_configure:
	dh_auto_configure -- --with-gtk=3.0 --enable-nettle --enable-gcrypt --enable-nautilus --enable-thunar --enable-nemo --enable-caja

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_makeshlibs:
	dh_makeshlibs -Xlibgtkhash-properties

override_dh_install:
	dh_install --list-missing

override_dh_auto_install:
	dh_auto_install

override_dh_autoreconf:
	mv m4/glib-gettext.m4 m4/glib-gettext.m4.old
	# Replace glib-gettext.m4 with a newest file
	cp /usr/share/aclocal/glib-gettext.m4 m4/
	dh_autoreconf --as-needed

override_dh_auto_test:
	mkdir -p $(HOME)
	dh_auto_test

# Replace the upstream M4 files.
override_dh_clean:
	dh_clean
	# Restore upstream glib-gettext.m4
	[ ! -f m4/glib-gettext.m4.old ] || mv m4/glib-gettext.m4.old m4/glib-gettext.m4
	rm -rf $(HOME)