#!/usr/bin/make -f

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

ifneq (,$(findstring amd64,$(DEB_BUILD_ARCH)))
DEB_CONFIGURE_FLAGS_EXTRA=--enable-arch=amd64
endif

LDFLAGS+=-Wl,--as-needed

%:
	dh $@ --parallel --with=autoreconf

override_dh_auto_configure:
	dh_auto_configure -- $(DEB_CONFIGURE_FLAGS_EXTRA)

override_dh_auto_install:
	dh_auto_install
	cd $(CURDIR)/debian/tmp/usr/share/phasex && \
		rm compile depcomp install-sh missing version-sh
	cd $(CURDIR)/debian/tmp/usr/share/doc/phasex && \
		rm LICENSE ChangeLog

# disable dh_auto_test, no test suite is provided
override_dh_auto_test:
override_dh_strip:
	dh_strip --dbg-package=phasex-dbg
