#!/usr/bin/make -f

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

# Large File Support
LFS_CFLAGS:=	$(shell getconf LFS_CFLAGS 2>/dev/null || echo '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64')
LFS_LDFLAGS:=	$(shell getconf LFS_LDFLAGS 2>/dev/null || true)

DEB_CFLAGS_MAINT_APPEND=	${LFS_CFLAGS}
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

DEB_LDFLAGS_MAINT_APPEND=	${LFS_LDFLAGS}

export DEB_CFLAGS_MAINT_APPEND DEB_LDFLAGS_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

%:
	dh $@
