#!/usr/bin/make -f
#export DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CPPFLAGS_MAINT_APPEND = -DUSE_SYSTEM_MD5_DEPENDENCY
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)

ifeq (, $(filter $(DEB_HOST_ARCH), i386 amd64))
   CONFIGURE += --disable-vectorization
else
   export DEB_CFLAGS_MAINT_APPEND = -msse4.1
   export DEB_CXXFLAGS_MAINT_APPEND = -msse4.1
endif


%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	cat debian/*manpages | sed 's/$$/.txt/p' | xargs -n 1 a2x --attribute=footer-style=none --doctype manpage --format manpage
	dh_auto_configure -- --enable-system-dependencies $(CONFIGURE)

override_dh_install:
	dh_install
	rm -f debian/lepton/usr/bin/test_invariants
