#! /usr/bin/make -f
%:
	dh $@

DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE  := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
CROSS :=
else
CROSS := CC=$(DEB_HOST_GNU_TYPE)-gcc
endif

export DEB_BUILD_MAINT_OPTIONS := hardening=+all
export DEB_CFLAGS_MAINT_APPEND := -Wall -D_FILE_OFFSET_BITS=64
include /usr/share/dpkg/buildflags.mk
FLAGS := CFLAGS='$(CPPFLAGS) $(CFLAGS)' LDFLAGS='$(LDFLAGS)'

override_dh_auto_build:
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	$(MAKE) $(CROSS) $(FLAGS)
else
	$(MAKE) debug $(CROSS) $(FLAGS)
endif

override_dh_installchangelogs:
	dh_installchangelogs debian/changelog-upstream.html
