
OCAMLC = @OCAMLC@
OCAMLDEP = @OCAMLDEP@
OCAMLINSTALLDIR = $(DESTDIR)$(OCAML_LIB_PREFIX)/gdome2

T_AUTO_MLI = \
  tNode.mli \
  tNodeList.mli \
  tNamedNodeMap.mli \
  tCharacterData.mli \
  tAttr.mli \
  tElement.mli \
  tText.mli \
  tComment.mli \
  tCDATASection.mli \
  tDocumentType.mli \
  tNotation.mli \
  tEntity.mli \
  tEntityReference.mli \
  tProcessingInstruction.mli \
  tDocumentFragment.mli \
  tDocument.mli \
  tEventTarget.mli \
  tEvent.mli \
  tMutationEvent.mli

BUILT_SOURCES = $(T_AUTO_MLI)

T_MLI = \
  $(T_AUTO_MLI) \
  gdomeT.mli \
  gdomeDOMExceptionT.mli \
  gdomeNodeTypeT.mli \
  tEventListener.mli \
  tDOMImplementation.mli

CLEANFILES = \
  $(T_AUTO_MLI) \
  $(T_MLI:%.mli=%.cmi)

EXTRA_DIST = \
  $(T_MLI) \
  .depend

all : $(T_MLI:%.mli=%.cmi)

XML2TMLI = $(srcdir)/../xsl/xml2tmli.xsl

if HAVE_XSLTPROC_COND

t%.mli : $(top_srcdir)/xml/DOM/Core/%.xml
	$(XSLTPROC) --param uriprefix "'$(top_srcdir)/xml/DOM/Core'" $(XML2TMLI) $< >$@

t%.mli : $(top_srcdir)/xml/DOM/Events/%.xml
	$(XSLTPROC) --param uriprefix "'$(top_srcdir)/xml/DOM/Events'" $(XML2TMLI) $< >$@

endif

install-data-local: $(T_MLI:%.mli=%.cmi) $(T_MLI)
	$(mkinstalldirs) $(OCAMLINSTALLDIR)
	for i in $(T_MLI); do \
		$(INSTALL_DATA) $(srcdir)/$$i $(OCAMLINSTALLDIR)/$$i; \
	done
	for i in $(T_MLI:%.mli=%.cmi); do \
		$(INSTALL_DATA) $$i $(OCAMLINSTALLDIR)/$$i; \
	done

#### OCaml only stuff from now on

DEPOBJS = $(T_MLI)

depend:
	$(OCAMLDEP) $(DEPOBJS) > .depend

%.cmi : $(srcdir)/%.mli
	if test ! -e $(@:%.cmi=%.mli) -a "x$(srcdir)" != "x." ; then $(LN_S) $< . ; fi
	$(OCAMLC) -c $(@:%.cmi=%.mli)

include .depend

