]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/mathml_editor/ocaml/Makefile.am
* disable-shared doens't bother ocaml
[helm.git] / helm / DEVEL / mathml_editor / ocaml / Makefile.am
1 PKGNAME = mathml-editor
2 ARCHIVE = mlmathml-editor
3 REQUIRES = gdome2 gdome2-xslt
4 OCAMLFIND = @OCAMLFIND@
5 OCAMLC = $(OCAMLFIND) @OCAMLC@ -package "$(REQUIRES)"
6 OCAMLOPT = $(OCAMLFIND) @OCAMLOPT@ -package "$(REQUIRES)"
7 OCAMLDEP = $(OCAMLFIND) @OCAMLDEP@ -package "$(REQUIRES)"
8 if HAVE_SHAREDLIBS_COND
9 OCAMLMKLIBFLAGS = 
10 else
11 OCAMLMKLIBFLAGS = -custom
12 endif
13 OCAMLMKLIB = @OCAMLMKLIB@ $(OCAMLMKLIBFLAGS)
14 DLL = dll$(ARCHIVE).so
15 OCAMLSTDLIBDIR = $(DESTDIR)/@OCAMLSTDLIBDIR@
16 OCAMLSTUBDIR = $(DESTDIR)/@OCAMLSTUBDIR@
17 OCAMLINSTALLDIR = $(OCAMLSTDLIBDIR)/$(PKGNAME)
18 MODULES = i_mathml_editor mathml_editor
19 INIT =
20 CMI_S = $(MODULES:%=%.cmi)
21 CMO_S = $(MODULES:%=%.cmo)
22 CMX_S = $(MODULES:%=%.cmx)
23 O_S = ml_mathml_editor.o c_mathml_editor.o
24 LO_S = $(O_S:%.o=%.lo)
25 SHARED_LIBS = $(GMETADOM_LIBS) $(GDOMEXSLT_LIBS) -lmlgdome2-xslt -lmlgdome
26 BYTE_STUFF = i_mathml_editor.cmi mathml_editor.cmi $(ARCHIVE).cma $(DLL)
27 NATIVE_STUFF = $(ARCHIVE).cmxa $(ARCHIVE).a
28 BYTE_INSTALL_STUFF = $(BYTE_STUFF) META
29 NATIVE_INSTALL_STUFF = $(NATIVE_STUFF)
30
31 EXTRA_DIST =    \
32         META.in mathml_editor.ml i_mathml_editor.ml     \
33         ml_mathml_editor.h c_mathml_editor.h .depend
34
35 if HAVE_OCAMLOPT_COND
36 noinst_DATA = $(BYTE_STUFF) $(NATIVE_STUFF)
37 else
38 noinst_DATA = $(BYTE_STUFF)
39 endif
40
41 noinst_LTLIBRARIES = libmlmathml-editor.la
42 libmlmathml_editor_la_SOURCES = \
43   c_mathml_editor.cc \
44   ml_mathml_editor.c
45
46 if HAVE_OCAMLOPT_COND
47 install-data-local:     $(BYTE_INSTALL_STUFF) $(NATIVE_INSTALL_STUFF)
48 else
49 install-data-local:     $(BYTE_INSTALL_STUFF)
50 endif
51         $(mkinstalldirs) $(OCAMLSTDLIBDIR) $(OCAMLSTUBDIR)
52         chmod -x $(DLL)
53         $(OCAMLFIND) install -destdir $(OCAMLSTDLIBDIR) $(PKGNAME) $^
54         ln -fs $(DLL) $(OCAMLSTUBDIR)/lib$(ARCHIVE).so
55
56 CLEANFILES =    \
57         $(ARCHIVE).{cma,cmxa,a} $(CMI_S) $(CMO_S) $(CMX_S) ml_mathml_editor.o   \
58         $(DLL) $(INIT).cm[iox] libmlmathml-editor.a
59
60 INCLUDES =      \
61         $(GDOME_CFLAGS) $(MLGDOME_CFLAGS) \
62         $(GMETADOM_CFLAGS) $(GDOMEXSLT_CFLAGS) \
63         -I$(top_srcdir)/src
64
65 $(ARCHIVE).cma: $(CMO_S)
66         $(OCAMLMKLIB) -o $(ARCHIVE) -L@OCAMLSTUBDIR@ $(CMO_S) $(SHARED_LIBS)
67
68 $(ARCHIVE).cmxa: $(CMX_S)
69         $(OCAMLMKLIB) -o $(ARCHIVE) -L@OCAMLSTUBDIR@ $(CMX_S) $(SHARED_LIBS)
70
71 $(DLL) $(ARCHIVE).a: $(LO_S)
72         # use .lo for ocamlmklib
73         for f in $(LO_S); do    \
74                 cp $$f $$f.o;   \
75         done
76         $(OCAMLMKLIB) -o $(ARCHIVE) $(GDOME_LIBS) $(LO_S:%=%.o)
77         for f in $(LO_S:%=%.o); do      \
78                 rm $$f; \
79         done
80
81 %.cmi: %.mli
82         $(OCAMLC) -c $<
83 %.cmo %.cmi: %.ml
84         $(OCAMLC) -c $<
85 %.cmx: %.ml %.cmi
86         $(OCAMLOPT) -c $<
87
88 i_mathml_editor.cmo: i_mathml_editor.ml
89         $(OCAMLC) -c $<
90 i_mathml_editor.cmx: i_mathml_editor.ml
91         $(OCAMLOPT) -c $<
92
93 depend: *.ml *.mli
94         $(OCAMLDEP) *.ml *.mli >.depend
95 include .depend
96