#!/usr/bin/make -f

UPSTREAM_VERSION = $(shell dpkg-parsechangelog | awk '{ if ($$1 == "Version:") { print($$2) } }' | cut -d - -f 1)

%:
	dh $@ --buildsystem=ruby --with ruby

override_dh_installman:
	help2man --no-info \
		   --include=debian/hikidoc.h2m \
		   --help-option="-I lib/ bin/hikidoc --help" \
		   --version-string=$(UPSTREAM_VERSION) \
		   /usr/bin/ruby >hikidoc.1
	dh_installman

override_dh_installdocs:
	# Need to use hikidoc to correctly format the TextFormattingRules page!
	ruby -I lib/ bin/hikidoc ./TextFormattingRules >| TextFormattingRules.html

	install -o root -g root -m 644 \
	    ./TextFormattingRules.html \
	    ./debian/ruby-hikidoc/usr/share/doc/ruby-hikidoc/html/TextFormattingRules.html
	install -o root -g root -m 644 \
	    ./debian/local/debian-openlogo.png \
	    ./debian/ruby-hikidoc/usr/share/doc/ruby-hikidoc/html/debian-openlogo.png

	dh_installdocs
