#!/usr/bin/make -f

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

DH_OPTIONS = -O--buildsystem=ruby

cmd = sass-spec

# generate manpages based on --help of script itself
_mkman = RUBYLIB=lib help2man \
 $(if $4,--version-string "$(strip $4)") $(if $3,--name "$(strip $3)") \
 --no-info --output $2 $1 \
 || { RUBYLIB=lib $1 --help; false; }

override_dh_auto_build:
	dh_auto_build
	cp -f $(cmd).rb $(cmd)
	chmod +x $(cmd)
	$(call _mkman, ./$(cmd), debian/$(cmd).1, \
		sass-spec testsuite for Sass implementions, \
		$(DEB_VERSION_UPSTREAM))

%:
	dh $@ --with ruby $(DH_OPTIONS:-O%=%)
