#! /usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
#include /usr/share/hardening-includes/hardening.make
include /usr/share/dpkg/buildflags.mk

CFLAGS		?= $(shell dpkg-buildflags --get CFLAGS)
CPPFLAGS	?= $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS		?= $(shell dpkg-buildflags --get LDFLAGS)
CFLAGS		+= $(HARDENING_CFLAGS)
CFLAGS		+= $(CPPFLAGS)
CPPFLAGS	+= $(HARDENING_CFLAGS)
LDFLAGS		+= $(HARDENING_LDFLAGS)

DESTDIR = $(CURDIR)/debian/tcplay

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	DEBUG = DEBUG=yes
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

# configure doesn't exists and it doesn't needed
override_dh_autoreconf:

override_dh_auto_build:
	make SYSTEM=linux PBKDF_BACKEND=gcrypt $(DEBUG)
#	make SYSTEM=linux PBKDF_BACKEND=gcrypt $(DEBUG) lib

# test needs the library, which can't be built ATM
override_dh_auto_test:

# for the rest, use debhelper
%:
	dh $@
