dnl CF_MAKE_DOCS version: 3 updated: 2014/01/05 13:21:25
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 -P -o0 -I$*_ -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
