#!/usr/bin/make -f
# debhelper config file for cookietool, the fortune database maintenance suite

CPPFLAGS=	$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS=		$(shell dpkg-buildflags --get CFLAGS)
LDFLAGS=	$(shell dpkg-buildflags --get LDFLAGS)

CFLAGS+=	-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
ifneq (,$(filter werror,$(DEB_BUILD_OPTIONS)))
	CFLAGS+=	-Werror
endif

include /usr/share/hardening-includes/hardening.make

ifeq (,$(filter nohardening,$(DEB_BUILD_OPTIONS)))
CFLAGS+=	$(HARDENING_CFLAGS)
LDFLAGS+=	$(HARDENING_LDFLAGS)
endif

export CFLAGS CPPFLAGS LDFLAGS

override_dh_auto_build:
	dh_auto_build
	awk '/^[0-9]+\..*History/ { disp = 1 } \
	     /^[0-9]/ && !/^[0-9]+\..*History/ { disp = 0 } \
	     { if (disp) { print } }' README > Changes

%:
	dh $@
