#!/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

DEB_CPPFLAGS_MAINT_APPEND=	-D_FILE_OFFSET_BITS=64 \
		-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700
export DEB_CPPFLAGS_MAINT_APPEND

DEB_CFLAGS_MAINT_APPEND=-pipe -Wall -W -ansi -pedantic -Wbad-function-cast \
		-Wcast-align -Wcast-qual -Wchar-subscripts -Winline \
		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
		-Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings
export DEB_CFLAGS_MAINT_APPEND

CFLAGS_ADD=
ifneq (,$(filter werror,$(DEB_BUILD_OPTIONS)))
CFLAGS_ADD+=	-Werror
endif

override_dh_auto_build:
	dh_auto_build -- CFLAGS="$(CFLAGS) $(CFLAGS_ADD)"

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