#Makefile.rules
#Rules for generating documentation in various formats
#and some common definitions

.PHONY: clean all all_no_pdf

#rule for procesing docbook documentation
#prefer using xsltproc and docbook.xsl (nicer output and is also faster)
# over docbook2html (which uses jade)
# TODO give parameter for XLSPATH from configure (set in ../Makefile.flags)
%.html: %.xml
	$(TOP_DIR)/tools/docbook2html_any $< $@ || true

#rule for generating PDF files
%.pdf: %.xml
	$(TOP_DIR)/tools/docbook2pdf $< $@ || true

# rule for generating manpages. We have to be sure that perl is installed
# Regenerate also when version or script for generating changes
%.1: %.xml $(TOP_DIR)/tools/docbook2man.pl $(TOP_DIR)/user/version.xml
	[ -x /usr/bin/perl ] || exit 1
	$(TOP_DIR)/tools/docbook2man.pl $< >$@

#rule for generating HTML documentation to be placed in application help directory
$(html_help_dir)/%.html: %.xml
	$(TOP_DIR)/tools/docbook2html $< $@ html || docbook2html -o $(html_help_dir) -u $< 2>&1 >/dev/null || true

#rule for generating docbook XML from .leaf files (some tex-like Trolltech format)
%.xml: %.leaf $(TOP_DIR)/tools/leaf2xml.pl
	$(TOP_DIR)/tools/leaf2xml.pl <$< >$@
