#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

UPSTREAM_TAG = android-$(subst +,_,$(DEB_VERSION_UPSTREAM))
export ANDROID_LIBVERSION = 0.$(subst +r,.,$(DEB_VERSION_UPSTREAM))
# See sdk/build_tools_source.prop_template in platform/development
export BUILD_TOOLS_VERSION = 23.0.2

%:
	dh $@

override_dh_auto_build:
	make -f debian/libandroidfw.mk
	make -f debian/libaapt.mk
	make -f debian/aapt.mk
	make -f debian/aidl.mk
	pandoc -s -o debian/aidl.1 debian/aidl.1.md
	make -f debian/split-select.mk
	pandoc -s -o debian/split-select.1 debian/split-select.1.md

override_dh_auto_clean:
	make clean -f debian/libandroidfw.mk
	make clean -f debian/libaapt.mk
	make clean -f debian/aapt.mk
	make clean -f debian/aidl.mk
	$(RM) debian/aidl.1
	make clean -f debian/split-select.mk
	$(RM) debian/split-select.1
	dh_auto_clean

override_dh_shlibdeps:
	dh_shlibdeps -l/usr/lib/android

get-orig-source: $(UPSTREAM_TAG).tar.gz
	mk-origtargz --repack --compression xz $<

$(UPSTREAM_TAG).tar.gz:
	wget https://android.googlesource.com/platform/frameworks/base/+archive/$(UPSTREAM_TAG).tar.gz