#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DEB_CFLAGS_MAINT_APPEND = '-DVERSION=\\\"$(DEB_VERSION)\\\"'

%:
	dh $@

override_dh_auto_build:
	# upstream Makefile does not support CPPFLAGS, abuse CFLAGS for it
	dh_auto_build -- \
		V=1 \
	 	CFLAGS="$(CPPFLAGS) $(CFLAGS)" \
	 	LDFLAGS="$(LDFLAGS)"
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
	debian/generate-manpage.sh bin/bt > debian/bt.1
endif

override_dh_auto_install:
	# * Don't hide commands, verbose mode
	# * Install under /usr, not /usr/local
	# * make install strips (for some reason), but we want to do that later
	#   with dh_strip, while keeping the symbols for dbgsym
	dh_auto_install -- \
		V=1 \
	       	PREFIX=/usr \
	       	STRIP=true
