#!/usr/bin/make -f

LDFLAGS += -Wl,--as-needed

%:
	dh --with=autoreconf $@

override_dh_autoreconf:
	mkdir -p m4
	dh_autoreconf

override_dh_install:
	dh_install
	# The changelog is installed in /usr/share/doc/easytag/changelog.gz
	[ ! -f debian/easytag/usr/share/easytag/ChangeLog ] || rm debian/easytag/usr/share/easytag/ChangeLog

VERSION = $(shell dpkg-parsechangelog | grep "^Version:" | sed -r "s/Version: (.*)-.*/\1/")

get-orig-source:
	cd debian && git clone --depth 1 git://github.com/stsquad/easytag.git
	cd debian/easytag && git archive --format=tar --prefix=easytag-$(VERSION)/ HEAD | \
		gzip -9c > ../../../easytag_$(VERSION).orig.tar.gz
	rm -rf debian/easytag
