# top_srcdir = @top_srcdir@
PART = xm/code
VPATH = $(top_srcdir)/$(PART)
@do_include@ $(top_srcdir)/$(PART)/Makefile.am
PERLXM = sh $(top_srcdir)/perlxm -I$(top_srcdir)

DISTFILES = Makefile.am Makefile.in # because do_include has set EXTRA_DIST
CLEANFILES = *.xml *.html
doc docs : index.html

index.html : $(xm_PM:.pm=.html) Makefile.html
	@ echo '<html><title>PM List</title></body><ul>' >$@
	@ if test "_$(SUBDIRS)" != "_" ; then : \
	; SUBDIRS="$(SUBDIRS)" ; for i in $$SUBDIRS ; do : \
	; echo '<li><a href="'"$$i/index.html"'">'"$$i/*"'</li>' >>$@ \
	; done fi
	@ for i in $? ; do : \
	; echo '<li><a href="'$$i'">'`basename $$i .html`'</li>' >>$@ \
	; done
	@ echo '</ul></body></html>' >>$@

%.xml : %.pm
	@ echo $@ : $<
	@ $(PERLXM) $(XMFLAGS) xm::code::perl: $(DOCARG) -- $< \
	| $(PERLXM) $(XMFLAGS) xm::allpre: - >$@
%.xml : %.am
	@ echo $@ : $<
	@ $(PERLXM) $(XMFLAGS) xm::code::make: $(DOCARG) -- $< \
	| $(PERLXM) $(XMFLAGS) xm::allpre: - >$@

%.html : %.xml
	@ echo $@ : $<
	@ $(PERLXM) $(XMFLAGS) xm::css::mkhtml4:  $(DOCARG) \
	-- --ext=xml --css=$(top_srcdir)/doc/docbook.css $<