#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk

CFLAGS += $(CPPFLAGS)
export CFLAGS LDFLAGS

ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	CONFIG = debug
else
	CONFIG = release
endif

BUILD_VERBOSITY = VERBOSE=1
ifneq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
	BUILD_VERBOSITY = VERBOSE=0
endif

ARGS = config=$(CONFIG) $(BUILD_VERBOSITY) PREFIX=/usr LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)

%:
	dh $@

override_dh_auto_build-arch:
	$(MAKE) $(ARGS)

override_dh_auto_install-arch:
	$(MAKE) $(ARGS) DESTDIR=$(CURDIR)/debian/tmp install

override_dh_auto_test:
	$(MAKE) $(ARGS) test
