#!/usr/bin/make -f

# Aim for the top, adapt if anything should break on the buildds.
DEB_BUILD_MAINT_OPTIONS=	hardening=+all future=+lfs
export DEB_BUILD_MAINT_OPTIONS

DEB_CPPFLAGS_MAINT_APPEND=	-D_DEFAULT_SOURCE
export DEB_CPPFLAGS_MAINT_APPEND

DEB_CFLAGS_MAINT_APPEND=	-pipe -Wall -W -Wbad-function-cast \
		-Wcast-align -Wcast-qual -Wchar-subscripts -Winline \
		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
		-Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings
ifneq (,$(filter werror,$(DEB_BUILD_OPTIONS)))
DEB_CFLAGS_MAINT_APPEND+=	-Werror
endif

export DEB_CFLAGS_MAINT_APPEND

_STRIP=		no
export _STRIP

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

override_dh_auto_install:
	dh_auto_install -- DESTDIR=$(CURDIR)/debian/tmp prefix=/usr \
		libdir=/usr/lib/$(DEB_HOST_MULTIARCH) install

override_dh_installchangelogs:
	dh_installchangelogs -X Changes
	set -e; for p in $$(dh_listpackages); do \
		install -m 644 -- Changes "$(CURDIR)/debian/$$p/usr/share/doc/$$p/NEWS"; \
	done

override_dh_makeshlibs:
	dh_makeshlibs -- -c4

%:
	dh $@
