#!/usr/bin/make -f

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed

%:
	dh ${@} --with autoreconf

override_dh_autoreconf:
	dh_autoreconf --as-needed

override_dh_auto_configure:
	dh_auto_configure -- --enable-shared --disable-static CFLAGS="$(CFLAGS) -D_LARGEFILE_SOURCE"

override_dh_auto_install:
	$(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
	rm -f $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.la
	install -D -m 0755 .libs/rdiff debian/tmp/usr/bin/rdiff

override_dh_install:
	dh_install --fail-missing

override_dh_strip:
	dh_strip --dbg-package=librsync-dbg
