#!/usr/bin/make -f
#export DH_VERBOSE = 1

%:
	dh $@ --with=autoreconf

override_dh_installdocs: debian/jpeg.1
		dh_installdocs

override_dh_auto_install-arch:
	# nothing since I cannot get DESTDIR to work

VERSION=$(shell grep Release README | tail -1 | cut -f1 -d: | cut -f2 -d' ')

debian/jpeg.1: debian/jpeg.1.in
ifeq (false,true)
	debian/libjpeg-tools/usr/bin/jpeg > debian/jpeg.tmp || true
	sed -i -e 's/^-/\n-/' -e '1i [DESCRIPTION]' debian/jpeg.tmp
	help2man --help-option=--info --include=debian/jpeg.tmp \
		--name="jpeg \- jpeg compressor" \
		--no-discard-stderr \
		--version-string=$(VERSION) \
		--help-option="--fake" \
		--output=$@ --no-info echo
else
	help2man --help-option=--info --include=$< \
		--version-string=$(VERSION) \
		--output=$@ --no-info debian/fake
endif

get-orig-source:
	uscan --download --force-download --rename
