ruby: Add unit test for new RLenValue type
[hivex.git] / ocaml / Makefile.am
1 # hivex OCaml bindings
2 # Copyright (C) 2009-2010 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         .depend META.in \
20         hivex.mli hivex.ml \
21         hivex_c.c \
22         t/*.ml
23
24 CLEANFILES = *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so
25 CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/*.o t/*.a t/*.so
26
27 AM_CPPFLAGS = \
28   -I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \
29   -I$(top_srcdir)/lib \
30   $(WARN_CFLAGS) $(WERROR_CFLAGS)
31
32 if HAVE_OCAML
33
34 noinst_DATA = mlhivex.cma META
35
36 if HAVE_OCAMLOPT
37 noinst_DATA += mlhivex.cmxa
38 endif
39
40 OBJS = hivex_c.o hivex.cmo
41 XOBJS = $(OBJS:.cmo=.cmx)
42
43 mlhivex.cma: $(OBJS)
44         $(OCAMLMKLIB) -o mlhivex $^ -L$(top_builddir)/lib/.libs -lhivex
45
46 mlhivex.cmxa: $(XOBJS)
47         $(OCAMLMKLIB) -o mlhivex $^ -L$(top_builddir)/lib/.libs -lhivex
48
49 hivex_c.o: hivex_c.c
50         $(CC) $(AM_CPPFLAGS) $(CFLAGS) -fPIC -Wall -c $<
51
52 TESTS_ENVIRONMENT = \
53         LD_LIBRARY_PATH=$(top_builddir)/lib/.libs:$(top_builddir)/ocaml \
54         $(VG)
55
56 TESTS = \
57         t/hivex_005_load \
58         t/hivex_010_open \
59         t/hivex_020_root \
60         t/hivex_100_errors \
61         t/hivex_110_gc_handle \
62         t/hivex_120_rlenvalue \
63         t/hivex_200_write \
64         t/hivex_300_fold
65 noinst_DATA += $(TESTS)
66
67 # https://www.redhat.com/archives/libguestfs/2011-May/thread.html#00015
68 t/%: t/%.cmo mlhivex.cma
69         $(LIBTOOL) --mode=execute -dlopen $(top_builddir)/lib/libhivex.la \
70           $(OCAMLFIND) ocamlc -dllpath $(abs_builddir) -package unix \
71           -linkpkg mlhivex.cma $< -o $@
72
73 .mli.cmi:
74         $(OCAMLFIND) ocamlc -package unix -c $< -o $@
75 .ml.cmo:
76         mkdir -p `dirname $@`
77         $(OCAMLFIND) ocamlc -package unix -c $< -o $@
78 .ml.cmx:
79         $(OCAMLFIND) ocamlopt -package unix -c $< -o $@
80
81 depend: .depend
82
83 .depend: $(wildcard *.mli) $(wildcard *.ml)
84         rm -f $@ $@-t
85         $(OCAMLFIND) ocamldep $^ | sed 's/  *$$//' | sort > $@-t
86         mv $@-t $@
87
88 include .depend
89
90 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
91
92 # Do the installation by hand, because we want to run ocamlfind.
93 install_files = META *.so *.a *.cma *.cmi $(srcdir)/*.mli
94
95 if HAVE_OCAMLOPT
96 install_files += *.cmx *.cmxa
97 endif
98
99 install-data-hook:
100         mkdir -p $(DESTDIR)$(OCAMLLIB)
101         mkdir -p $(DESTDIR)$(OCAMLLIB)/stublibs
102         $(OCAMLFIND) install \
103           -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
104           $(PACKAGE_NAME) \
105           $(install_files)
106
107 CLEANFILES += $(noinst_DATA)
108
109 endif
110
111 # Tell version 3.79 and up of GNU make to not build goals in this
112 # directory in parallel.  (See RHBZ#502309).
113 .NOTPARALLEL: