#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

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

%:
	dh $@

override_dh_clean:
	dh_clean
	rm -f core/adb/*.o core/adb/adb core/fastboot/*.o core/fastboot/fastboot

override_dh_auto_build:
	cd core/adb && make CC=$(CC)
	cd core/fastboot && make CC=$(CC)

override_dh_install:
	dh_install --sourcedir=.
