#!/usr/bin/make -f

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

PKD   = $(word 1,$(abspath $(dir $(MAKEFILE_LIST))))
PKG   = $(DEB_SOURCE)
UVER  = $(shell echo $(DEB_VERSION) | cut -d "-" -f1)

%:
	dh $@

new-upstream-version:
	mkdir -p $(PKG)-$(UVER)/
	rsync -av --delete --exclude=debian/ --exclude=$(PKG)-$(UVER)/ * $(PKG)-$(UVER)/
	find "$(PKG)-$(UVER)" -xdev \( -type f -o -type l \) -print| sort \
	    | tar -cJaf "../$(PKG)_$(UVER).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
	    && $(RM) -r "$(PKG)-$(UVER)"
