1 # libguestfs virt-sparsify tool
2 # Copyright (C) 2011 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 include $(top_srcdir)/subdir-rules.mk
25 CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o virt-sparsify test.img
37 # Note this list must be in dependency order.
39 ../fish/guestfish-progress.o \
45 bin_SCRIPTS = virt-sparsify
47 # -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
48 # option to be passed to gcc, so we don't try linking against an
49 # installed copy of libguestfs.
50 OCAMLPACKAGES = -package unix -I $(top_builddir)/src/.libs -I ../ocaml
52 OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
53 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
55 virt-sparsify: $(OBJECTS)
56 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
57 mlguestfs.cmxa -linkpkg $^ -cclib -lncurses -o $@
60 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
62 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
64 $(OCAMLFIND) ocamlopt $(OCAMLCFLAGS) -c $< -o $@
66 # automake will decide we don't need C support in this file. Really
67 # we do, so we have to provide it ourselves.
69 DEFAULT_INCLUDES = -I. -I$(top_builddir) -I$(shell $(OCAMLC) -where) -I../fish
72 $(CC) $(CFLAGS) $(PROF_CFLAGS) $(DEFAULT_INCLUDES) -c $< -o $@
74 # Manual pages and HTML files for the website.
76 man_MANS = virt-sparsify.1
78 noinst_DATA = $(top_builddir)/html/virt-sparsify.1.html
80 virt-sparsify.1 $(top_builddir)/html/virt-sparsify.1.html: stamp-virt-sparsify.pod
82 stamp-virt-sparsify.pod: virt-sparsify.pod
83 $(top_builddir)/podwrapper.sh \
84 --man virt-sparsify.1 \
85 --html $(top_builddir)/html/virt-sparsify.1.html \
89 CLEANFILES += stamp-virt-sparsify.pod
93 random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
96 MALLOC_PERTURB_=$(random_val) \
97 LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
98 LIBGUESTFS_PATH=$(top_builddir)/appliance \
99 TMPDIR=$(top_builddir)
101 TESTS = test-virt-sparsify.sh
106 .depend: $(wildcard *.mli) $(wildcard *.ml)
108 $(OCAMLFIND) ocamldep -I ../ocaml $^ | \
109 $(SED) 's/ *$$//' | \
110 $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
120 # Parallel builds don't obey dependencies for some reason we