#!/usr/bin/make -f
# -*- makefile -*-
UPSTREAMTAG=upstream/3.4.0.47.4

UPSTREAM_VERSION=$(subst upstream/,,${UPSTREAMTAG})
SOURCEPKG=$(shell dpkg-parsechangelog | sed  -n 's/^Source: \(.*\)/\1/p')
ORIG=${SOURCEPKG}_${UPSTREAM_VERSION}.orig.tar.gz

%: 
	dh $@

override_dh_auto_configure:
	sh ./autogen.sh
	dh_auto_configure -- --prefix=/usr

get-orig-source: 
	git archive --format=tar --prefix=${SOURCEPKG}-${UPSTREAM_VERSION}/ ${UPSTREAMTAG} | gzip -9 > ../${ORIG}

override_dh_strip:
	dh_strip --dbg-package=libsynthesis-dbg

override_dh_makeshlibs:
	dh_makeshlibs -V

PATCH_EXPORT_SCRIPT=/usr/share/gitpkg/hooks/quilt-patches-deb-export-hook
export-patches:
	[ ! -r debian/patches ] || \
	grep "^\#*$(notdir $(PATCH_EXPORT_SCRIPT))" debian/patches/series
	rm -rf debian/patches
	sh $(PATCH_EXPORT_SCRIPT)
