#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
LDFLAGS += -fPIE -pie

# export DH_OPTIONS
include /usr/share/dpkg/architecture.mk

CONFFLAGS =
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
  CC = $(DEB_HOST_GNU_TYPE)-gcc
else
  CC = gcc
endif

ifneq (,$(filter diet, $(DEB_BUILD_OPTIONS)))
  CONFFLAGS =--disable-zlib
  CC =diet -v -Os gcc -nostdinc
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --disable-bundled-libtom --disable-lastlog \
	  CC='$(CC)' CFLAGS='$(CFLAGS)' $(CONFFLAGS)

execute_before_dh_auto_build:
	install -m0644 -vt $(CURDIR) -- $(CURDIR)/debian/localoptions.h

override_dh_auto_test:
	# we skip the upstream test suite as some tests require readwrite
	# access to ~/.ssh
