1
2OCAMLBUILDDIR = $(top_builddir)/src/gdome_caml
3OCAMLINSTALLDIR = $(DESTDIR)$(OCAML_LIB_PREFIX)/gdome2
4OCAMLFLAGS = -I $(OCAMLBUILDDIR)/types -I $(OCAMLBUILDDIR)/basic
5OCAMLC = @OCAMLC@ ${OCAMLFLAGS}
6OCAMLOPT = @OCAMLOPT@ ${OCAMLFLAGS}
7OCAMLDEP = @OCAMLDEP@
8OCAML_CFLAGS  = @OCAML_CFLAGS@
9
10AUTO_C = \
11  ml_Node.c \
12  ml_NodeList.c \
13  ml_NamedNodeMap.c \
14  ml_CharacterData.c \
15  ml_Attr.c \
16  ml_Element.c \
17  ml_Text.c \
18  ml_Comment.c \
19  ml_CDATASection.c \
20  ml_DocumentType.c \
21  ml_Notation.c \
22  ml_Entity.c \
23  ml_EntityReference.c \
24  ml_ProcessingInstruction.c \
25  ml_DocumentFragment.c \
26  ml_Document.c
27
28I_AUTO_ML = \
29  iNode.ml \
30  iNodeList.ml \
31  iNamedNodeMap.ml \
32  iCharacterData.ml \
33  iAttr.ml \
34  iElement.ml \
35  iText.ml \
36  iComment.ml \
37  iCDATASection.ml \
38  iDocumentType.ml \
39  iNotation.ml \
40  iEntity.ml \
41  iEntityReference.ml \
42  iProcessingInstruction.ml \
43  iDocumentFragment.ml \
44  iDocument.ml
45
46# OCaml objects
47OCAML_OBJECTS = $(I_AUTO_ML:%.ml=%.cmo) \
48                $(I_AUTO_ML:%.ml=%.cmi) \
49                $(I_AUTO_ML:%.ml=%.cmx) \
50                $(I_AUTO_ML:%.ml=%.o)
51
52BUILT_SOURCES = $(AUTO_C) $(I_AUTO_ML)
53
54MAINTAINERCLEANFILES = \
55  $(AUTO_C) \
56  $(I_AUTO_ML)
57
58CLEANFILES = \
59  $(OCAML_OBJECTS)
60
61EXTRA_DIST = $(AUTO_C) $(I_AUTO_ML) .depend .linkorder
62
63XML2C = $(srcdir)/../xsl/xml2c.xsl
64XML2MLI = $(srcdir)/../xsl/xml2mli.xsl
65
66if HAVE_OCAMLOPT_COND
67noinst_DATA = $(I_AUTO_ML:%.ml=%.cmo) $(I_AUTO_ML:%.ml=%.cmx)
68else
69noinst_DATA = $(I_AUTO_ML:%.ml=%.cmo)
70endif
71
72noinst_LTLIBRARIES = libcore.la
73
74libcore_la_SOURCES = $(AUTO_C)
75
76$(AUTO_C) : $(XML2C)
77$(I_AUTO_ML) : $(XML2MLI)
78
79if HAVE_XSLTPROC_COND
80
81ml_%.c : $(top_srcdir)/xml/DOM/Core/%.xml
82	$(XSLTPROC) --param uriprefix "'$(top_srcdir)/xml/DOM/Core'" --param annotations "'$(srcdir)/../xml/Core/$*.xml'" $(XML2C) $< >$@
83
84i%.ml : $(top_srcdir)/xml/DOM/Core/%.xml $(srcdir)/../xml/Core/%.xml
85	$(XSLTPROC) --param uriprefix "'$(top_srcdir)/xml/DOM/Core'" --param annotations "'$(srcdir)/../xml/Core/$*.xml'" $(XML2MLI) $< >$@
86
87endif
88
89INCLUDES = \
90  $(OCAML_CFLAGS) \
91  $(GDOME_CFLAGS) \
92  -I$(srcdir)/../include
93
94install-data-local: $(I_AUTO_ML:%.ml=%.cmi)
95	$(mkinstalldirs) $(OCAMLINSTALLDIR)
96	for i in $^; do \
97		$(INSTALL_DATA) $$i $(OCAMLINSTALLDIR); \
98	done
99	for i in $(I_AUTO_ML); do \
100		$(INSTALL_DATA) $(srcdir)/$$i $(OCAMLINSTALLDIR); \
101	done
102
103#### OCaml only stuff from now on
104
105DEPOBJS = $(I_AUTO_ML)
106LINKORDER = iNode iNodeList iNamedNodeMap iCharacterData iAttr iElement iText iComment iCDATASection iDocumentType iNotation iEntity iEntityReference iProcessingInstruction iDocumentFragment iDocument
107
108depend:
109	$(OCAMLDEP) $(DEPOBJS) > .depend
110	echo "$(LINKORDER)" > .linkorder
111
112%.cmi : $(srcdir)/%.mli
113	if test ! -e $(@:%.cmi=%.mli) -a "x$(srcdir)" != "x." ; then $(LN_S) $< . ; fi
114	$(OCAMLC) -c $(@:%.cmi=%.mli)
115
116%.cmo : $(srcdir)/%.ml
117	if test ! -e $(@:%.cmo=%.ml) -a "x$(srcdir)" != "x." ; then $(LN_S) $< . ; fi
118	$(OCAMLC) -c $(@:%.cmo=%.ml)
119
120%.cmx %.o : $(srcdir)/%.ml
121	if test ! -e $(@:%.cmx=%.ml) -a "x$(srcdir)" != "x." ; then $(LN_S) $< . ; fi
122	$(OCAMLOPT) -c $(@:%.cmx=%.ml)
123
124include .depend
125
126