#!/usr/bin/make -f

DEB_DH_INSTALL_SOURCEDIR=debian/tmp

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/autoreconf.mk

DEB_DH_MAKESHLIBS_ARGS=-V

ORIG_MAJOR=$(shell git describe upstream | cut -d- -f1)
ORIG_GIT=$(shell git describe upstream | cut -d- -f2)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_CONFIGURE_EXTRA_FLAGS += --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)

post-patches:: configure-stamp
configure-stamp:
	test -f configure || sh ./autogen.sh $(DEB_CONFIGURE_NORMAL_ARGS)
	touch configure-stamp

cleanbuilddir::
	rm -f configure-stamp

	# Specific to Git Debian package
	rm -f Doxyfile .gitmodules autogen.sh

get-orig-source:
	git archive upstream | gzip -9 > ../xcb-util_$(ORIG_MAJOR)+git$(ORIG_GIT).orig.tar.gz

.PHONY: get-orig-source
