#! /usr/bin/make -f

# export DH_VERBOSE=1

pkg-ver  := $(shell dpkg-parsechangelog | sed -ne 's/^Version: //p')
pkg-dte  := $(shell grep '@set RELEASE' vera.texi | cut -f3,4 -d' ')

%:
	dh $@

override_dh_auto_build-indep:
	makeinfo --no-split vera.texi
	sed -f debian/sedfile vera.? >> vera
	/usr/bin/dictfmt -f -u http://home.snafu.de/ohei \
	    -s "V.E.R.A. -- Virtual Entity of Relevant Acronyms ($(pkg-dte))" \
	   vera < vera 
	/usr/bin/dictzip -v vera.dict
	rm -f vera.tmp vera

debian/changes: build-indep
	info ./vera.info History | \
	    sed -n '/^File: vera.info, .*/d;/^\*Installation as Info file\*$$/q;p' > $@

override_dh_installchangelogs: debian/changes
	dh_installchangelogs $<

override_dh_gencontrol:
	dh_gencontrol -pvera
	# dict-vera was previously its own source package, give its version a 1:
	# prefix
	dh_gencontrol -pdict-vera -- -v1:$(pkg-ver)

override_dh_auto_clean:
	rm -f debian/changes
	dh_auto_clean
