#!/usr/bin/make -f

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

include /usr/share/dpkg/architecture.mk

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
confflags= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
else
confflags= --build $(DEB_BUILD_GNU_TYPE)
endif

DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
CFLAGS += -g -Wall

%:
	dh $@

override_dh_autoreconf::
	# Avoid autoconf rebuild due to patching input files.
	touch --reference=aclocal.m4 configure m4/needtrio.m4
	touch --reference=Makefile.am m4/needtrio.m4
	dh_update_autotools_config

override_dh_auto_configure:
	CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" dh_auto_configure -- \
			--with-pager=/etc/alternatives/pager \
			--disable-rpath \
			--with-libidn2 \
			$(confflags)

override_dh_clean:
	rm -f doc/lftp.inf*
	dh_clean

override_dh_install:
	dh_install
	rm -rf $(CURDIR)/debian/*/usr/lib
