#!/usr/bin/make -f
# -*- makefile -*-

export DH_VERBOSE=1

# true prevents autoreconf invokes these tools
export AUTOPOINT=true
export AUTOHEADER=true
export LIBTOOLIZE=true

##########################################################################
# I need to investigate why CDBS doesn't export automatically build flags 
# needed for hardening. This block should be temporal.
CFLAGS = `dpkg-buildflags --get CFLAGS`
CFLAGS += -O3
LDFLAGS = `dpkg-buildflags --get LDFLAGS`
LDFLAGS += -Wl,-z,defs
CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
DEB_CONFIGURE_SCRIPT_ENV += CFLAGS="$(CFLAGS)"
DEB_CONFIGURE_SCRIPT_ENV += LDFLAGS="$(LDFLAGS)"
DEB_CONFIGURE_SCRIPT_ENV += CPPFLAGS="$(CPPFLAGS)"
##########################################################################

DEB_CONFIGURE_SCRIPT_ENV += LIBS="-Wl,--no-as-needed -ldl -Wl,--as-needed"
DEB_CONFIGURE_SCRIPT_ENV += CPPFLAGS="-DHAVE_DYNAMIC_LIBPCRE"

include /usr/share/cdbs/1/rules/autoreconf.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

binary-fixup/grep::
	rm -f debian/grep/usr/share/info/dir.gz
