## Process this with automake to create Makefile.in
docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)

EXTRA_MANS = RefDB.7 refdb.8 refdbd.1 refdba.1 refdbc.1 refdbib.1 bib2ris.1 db2ris.1 en2ris.1 marc2ris.1 med2ris.1 eenc.1 refdb-backup.1 refdb-ms.1 refdb-restore.1 refdbjade.1 refdbnd.1 refdbxml.1 runbib.1 refdbctl.1 refdbxp.1 refdb-init.8 refdb-bug.1 refdb_dos2unix.1 refdb_tex2mail.1 refdb.sh.8 refdb-init-pgsql.8 refdb_latex2utf8txt.1 bib2ris-utf8.1 rtfcitations.1 refdbrtf.1

man_MANS = @server_mans@ @client_mans@

# hack hack hack! refdb.sh.8 is automatically generated when we process
# refdb.8.xml. refdb and refdb.sh are synonyms. To keep the processing of
# the xml files simple, we can't include refdb.sh.8 into man_MANS. However,
# we can include it into man1_MANS so it will be installed ok. The
# dependency just makes sure man_MANS is processed before man1_MANS
man1_MANS = @client1_mans@
man8_MANS = @server8_mans@

refdb.sh.8: refdb.8

refdb-init-pgsql.8: refdb-init.8

bib2ris-utf8.1: bib2ris.1

EXTRA_DIST = $(man_MANS) $(man1_MANS) $(man8_MANS)

all: $(man_MANS) $(man1_MANS) $(man8_MANS)

$(man_MANS): %: $(top_srcdir)/doc/%.xml
	xsltproc --nonet $(top_srcdir)/doc/include/manual-man.xsl $<
#	sed 's%<manualpath>%$(DESTDIR)$(docdir)%' < $< | \
#	sed 's%<sharepath>%$(DESTDIR)$(pkgdatadir)/db%' | \
#	sed 's%<runpath>%$(DESTDIR)$(var_dir)%' | \
#	sed 's%<etcpath>%$(DESTDIR)$(sysconfdir)/@PACKAGE@%' > $@

maintainer-clean:
	rm -f $(man_MANS) $(man1_MANS) $(man8_MANS)

