dnl CF_MAKE_DOCS version: 1 updated: 2012/04/29 11:02:32
dnl ------------
dnl $1 = name(s) to generate rules for
dnl $2 = suffix of corresponding manpages used as input.
define([CF_MAKE_DOCS],[
test -z "$cf_make_docs" && cf_make_docs=0

cf_output=makefile
test -f "$cf_output" || cf_output=Makefile

if test "$cf_make_docs" = 0
then
cat >>$cf_output <<"CF_EOF"
################################################################################
.SUFFIXES : .html .$2 .man .ps .pdf .txt

.$2.html :
	GROFF_NO_SGR=stupid [$](SHELL) -c "tbl [$]*.$2 | groff -Thtml -man" >[$]@

.$2.ps :
	[$](SHELL) -c "tbl [$]*.$2 | groff -man" >[$]@

.$2.txt :
	GROFF_NO_SGR=stupid [$](SHELL) -c "tbl [$]*.$2 | nroff -Tascii -man | col -bx" >[$]@

.ps.pdf :
	ps2pdf [$]*.ps

CF_EOF
	cf_make_docs=1
fi

for cf_name in $1
do
cat >>$cf_output <<CF_EOF
################################################################################
docs-$cf_name \\
docs :: $cf_name.html \\
	$cf_name.pdf \\
	$cf_name.ps \\
	$cf_name.txt

clean \\
docs-clean ::
	rm -f $cf_name.html $cf_name.pdf $cf_name.ps $cf_name.txt

$cf_name.html : $cf_name.$2
$cf_name.pdf : $cf_name.ps
$cf_name.ps : $cf_name.$2
$cf_name.txt : $cf_name.$2
CF_EOF
done
])dnl
