Generated code for e2fsck-f command.
[libguestfs.git] / ocaml / Makefile.am
1 # libguestfs OCaml bindings
2 # Copyright (C) 2009 Red Hat Inc.
3 #
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.
8 #
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.
13 #
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.
17
18 EXTRA_DIST = \
19         guestfs.mli guestfs.ml \
20         guestfs_c.c guestfs_c.h guestfs_c_actions.c \
21         .depend META.in \
22         t/*.ml
23
24 SUBDIRS = examples
25
26 CLEANFILES = *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so
27 CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/*.o t/*.a t/*.so
28
29 if HAVE_OCAML
30
31 noinst_DATA = mlguestfs.cma mlguestfs.cmxa META
32
33 mlguestfs.cma: guestfs_c.o guestfs_c_actions.o guestfs.cmo
34         $(OCAMLMKLIB) -o mlguestfs $^ -L$(top_builddir)/src/.libs -lguestfs
35
36 mlguestfs.cmxa: guestfs_c.o guestfs_c_actions.o guestfs.cmx
37         $(OCAMLMKLIB) -o mlguestfs $^ -L$(top_builddir)/src/.libs -lguestfs
38
39 guestfs_c.o: guestfs_c.c
40         $(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_builddir)/src -fPIC -Wall -c $<
41
42 guestfs_c_actions.o: guestfs_c_actions.c
43         $(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_builddir)/src -fPIC -Wall -c $<
44
45 TESTS_ENVIRONMENT = \
46         LD_LIBRARY_PATH=$(abs_top_builddir)/src/.libs \
47         LIBGUESTFS_PATH=$(abs_top_builddir) \
48         $(VG)
49
50 TESTS = t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate
51 noinst_DATA += $(TESTS)
52
53 t/guestfs_005_load: t/guestfs_005_load.ml mlguestfs.cmxa
54         $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
55
56 t/guestfs_010_launch: t/guestfs_010_launch.ml mlguestfs.cmxa
57         $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
58
59 t/guestfs_050_lvcreate: t/guestfs_050_lvcreate.ml mlguestfs.cmxa
60         $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
61
62 .mli.cmi:
63         $(OCAMLFIND) ocamlc -c $<
64 .ml.cmo:
65         $(OCAMLFIND) ocamlc -c $<
66 .ml.cmx:
67         $(OCAMLFIND) ocamlopt -c $<
68
69 depend: .depend
70
71 .depend: $(wildcard *.mli) $(wildcard *.ml)
72         rm -f .depend
73         $(OCAMLFIND) ocamldep $^ > $@
74
75 include .depend
76
77 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
78
79 # Do the installation by hand, because we want to run ocamlfind.
80 install-data-hook:
81         mkdir -p $(DESTDIR)$(OCAMLLIB)
82         mkdir -p $(DESTDIR)$(OCAMLLIB)/stublibs
83         $(OCAMLFIND) install \
84           -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
85           guestfs \
86           META *.so *.a *.cma *.cmx *.cmxa *.cmi *.mli
87
88 CLEANFILES += $(noinst_DATA)
89
90 endif