## Process this file with automake to produce Makefile.in

objects = citestylex.dtd citationlistx.dtd risx.dtd xnote.dtd
schemas = citestylex.rnc citationlistx.rnc risx.rnc xnote.rnc
xschemas = citestylex.rng citationlistx.rng risx.rng xnote.rng
install_objects = catalog $(objects) $(schemas) $(xschemas)
EXTRA_DIST = $(objects) $(schemas) $(xschemas) catalog.in
noinst_DATA = catalog $(schemas) $(xschemas)
MOSTLYCLEANFILES = catalog
MAINTAINERCLEANFILES = $(schemas) $(xschemas)

RISXVERSION = $(shell grep DOCTYPE $(srcdir)/risx.dtd | sed 's%.*V\([^/]*\).*%\1%')
XNOTEVERSION = $(shell grep DOCTYPE $(srcdir)/xnote.dtd | sed 's%.*V\([^/]*\).*%\1%')
CITESTYLEXVERSION = $(shell grep DOCTYPE $(srcdir)/citestylex.dtd | sed 's%.*V\([^/]*\).*%\1%')
CITATIONLISTXVERSION = $(shell grep DOCTYPE $(srcdir)/citationlistx.dtd | sed 's%.*V\([^/]*\).*%\1%')

all: catalog $(schemas)

catalog: catalog.in
	sed 's%<risxversion>%$(RISXVERSION)%' < catalog.in | \
	sed 's%<xnoteversion>%$(XNOTEVERSION)%' | \
	sed 's%<citestylexversion>%$(CITESTYLEXVERSION)%' | \
	sed 's%<citationlistxversion>%$(CITATIONLISTXVERSION)%'	> catalog

%.rnc: %.dtd
	@trang_cmd@ $< $@

%.rng: %.dtd
	@trang_cmd@ $< $@

install-data-local:
	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/dtd
	@for f in $(install_objects); do \
		$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(pkgdatadir)/dtd/$$f; \
	done

