2 # Copyright (C) 2009-2010 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.
24 CLEANFILES = *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so
25 CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/*.o t/*.a t/*.so
28 -I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \
30 $(WARN_CFLAGS) $(WERROR_CFLAGS)
34 noinst_DATA = mlhivex.cma META
37 noinst_DATA += mlhivex.cmxa
40 OBJS = hivex_c.o hivex.cmo
41 XOBJS = $(OBJS:.cmo=.cmx)
44 $(OCAMLMKLIB) -o mlhivex $^ -L$(top_builddir)/lib/.libs -lhivex
46 mlhivex.cmxa: $(XOBJS)
47 $(OCAMLMKLIB) -o mlhivex $^ -L$(top_builddir)/lib/.libs -lhivex
50 $(CC) $(AM_CPPFLAGS) $(CFLAGS) -fPIC -Wall -c $<
53 LD_LIBRARY_PATH=$(top_builddir)/lib/.libs:$(top_builddir)/ocaml \
61 t/hivex_110_gc_handle \
64 noinst_DATA += $(TESTS)
66 # https://www.redhat.com/archives/libguestfs/2011-May/thread.html#00015
67 t/%: t/%.cmo mlhivex.cma
68 $(LIBTOOL) --mode=execute -dlopen $(top_builddir)/lib/libhivex.la \
69 $(OCAMLFIND) ocamlc -dllpath $(abs_builddir) -package unix \
70 -linkpkg mlhivex.cma $< -o $@
73 $(OCAMLFIND) ocamlc -package unix -c $< -o $@
76 $(OCAMLFIND) ocamlc -package unix -c $< -o $@
78 $(OCAMLFIND) ocamlopt -package unix -c $< -o $@
82 .depend: $(wildcard *.mli) $(wildcard *.ml)
84 $(OCAMLFIND) ocamldep $^ | sed 's/ *$$//' | sort > $@-t
89 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
91 # Do the installation by hand, because we want to run ocamlfind.
92 install_files = META *.so *.a *.cma *.cmi $(srcdir)/*.mli
95 install_files += *.cmx *.cmxa
99 mkdir -p $(DESTDIR)$(OCAMLLIB)
100 mkdir -p $(DESTDIR)$(OCAMLLIB)/stublibs
101 $(OCAMLFIND) install \
102 -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
106 CLEANFILES += $(noinst_DATA)
110 # Tell version 3.79 and up of GNU make to not build goals in this
111 # directory in parallel. (See RHBZ#502309).