#! /usr/bin/make -f

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

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

%:
	dh $@

override_dh_auto_build:
# Make small unless we are building a debug package.
ifeq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	$(MAKE) small CC=$(CC) STRIP=$(STRIP)
else
	$(MAKE) DEBUG=1 CC=$(CC)
endif
