1 # libguestfs OCaml bindings
2 # Copyright (C) 2009 Red Hat Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 guestfs.mli guestfs.ml \
20 guestfs_c.c guestfs_c.h guestfs_c_actions.c \
28 CLEANFILES = *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so
29 CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/*.o t/*.a t/*.so
31 AM_CPPFLAGS = -I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \
32 -I$(top_srcdir)/src -I$(top_builddir)/src
36 noinst_DATA = mlguestfs.cma mlguestfs.cmxa META
38 mlguestfs.cma: guestfs_c.o guestfs_c_actions.o guestfs.cmo
39 $(OCAMLMKLIB) -o mlguestfs $^ -L$(top_builddir)/src/.libs -lguestfs
41 mlguestfs.cmxa: guestfs_c.o guestfs_c_actions.o guestfs.cmx
42 $(OCAMLMKLIB) -o mlguestfs $^ -L$(top_builddir)/src/.libs -lguestfs
44 guestfs_c.o: guestfs_c.c
45 $(CC) $(AM_CPPFLAGS) $(CFLAGS) -fPIC -Wall -c $<
47 guestfs_c_actions.o: guestfs_c_actions.c
48 $(CC) $(AM_CPPFLAGS) $(CFLAGS) -fPIC -Wall -c $<
51 LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
52 LIBGUESTFS_PATH=$(top_builddir)/appliance \
55 TESTS = run-bindtests \
56 t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate \
58 noinst_DATA += bindtests \
59 t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate \
62 bindtests: bindtests.cmx mlguestfs.cmxa
64 $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
66 t/guestfs_005_load: t/guestfs_005_load.cmx mlguestfs.cmxa
68 $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
70 t/guestfs_010_launch: t/guestfs_010_launch.cmx mlguestfs.cmxa
72 $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
74 t/guestfs_050_lvcreate: t/guestfs_050_lvcreate.cmx mlguestfs.cmxa
76 $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
78 t/guestfs_060_readdir: t/guestfs_060_readdir.cmx mlguestfs.cmxa
80 $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
82 # Need to rebuild the tests from source if the main library has
83 # changed at all, otherwise we get inconsistent assumptions.
84 t/%.cmx: t/%.ml mlguestfs.cmxa
85 $(OCAMLFIND) ocamlopt -c $< -o $@
88 $(OCAMLFIND) ocamlc -c $< -o $@
90 $(OCAMLFIND) ocamlc -c $< -o $@
92 $(OCAMLFIND) ocamlopt -c $< -o $@
96 .depend: $(wildcard *.mli) $(wildcard *.ml)
98 $(OCAMLFIND) ocamldep $^ | sed 's/ *$$//' > $@-t
103 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
105 # Do the installation by hand, because we want to run ocamlfind.
107 mkdir -p $(DESTDIR)$(OCAMLLIB)
108 mkdir -p $(DESTDIR)$(OCAMLLIB)/stublibs
109 $(OCAMLFIND) install \
110 -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
112 META *.so *.a *.cma *.cmx *.cmxa *.cmi *.mli
114 CLEANFILES += $(noinst_DATA)
118 # Tell version 3.79 and up of GNU make to not build goals in this
119 # directory in parallel. (Possible solution for RHBZ#502309).