#! /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

include /usr/share/dpkg/buildflags.mk
FLAGS := CFLAGS='$(CPPFLAGS) $(CFLAGS) -Wall' 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
