#!/usr/bin/make -f

cmd = eye.pvm

# generate manpage with help2man from --help option of executable
_mkman = help2man $(if $3,--name "$(strip $3)") --no-info --no-discard-stderr --output $2 $1 \
 || { $1 --help; false; }

override_dh_auto_build:
	swipl -q -f eye.prolog -g main -- --image $(cmd)
	$(call _mkman, ./$(cmd), debian/$(cmd).1, \
		Euler Yet another proof Engine (EYE) semantic web reasoning engine)

# fix hashbang
override_dh_installexamples:
	dh_installexamples
	find debian/*/usr/share/doc/*/examples -type f -name test -print0 | \
		xargs -r0 sed -i -e '2s|^eye |eye.pvm |'

%:
	dh $@