Implement similarity code.
[virt-similarity.git] / Makefile.am
1 # virt-similarity
2 # Copyright (C) 2013 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 ACLOCAL_AMFLAGS = -I m4
19
20 EXTRA_DIST = \
21         COPYING \
22         README \
23         config.ml.in \
24         virt-similarity.spec \
25         virt-similarity.spec.in \
26         $(SOURCES)
27
28 CLEANFILES = *~ *.cmi *.cmo *.cmx *.cma *.cmxa virt-similarity
29
30 OCAMLPACKAGES = -package unix,guestfs
31 OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
32 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
33
34 # Sources in alphabetical order.
35 SOURCES = \
36         cache.mli \
37         cache.ml \
38         cladogram.mli \
39         cladogram.ml \
40         config.ml \
41         hash.ml \
42         similarity.ml \
43         utils.ml
44
45 # Objects in build order.
46 OBJECTS = \
47         config.cmo \
48         utils.cmo \
49         hash.cmo \
50         cache.cmo \
51         cladogram.cmo \
52         similarity.cmo
53
54 XOBJECTS = $(OBJECTS:.cmo=.cmx)
55
56 bin_SCRIPTS = virt-similarity
57
58 if HAVE_OCAMLOPT
59 virt-similarity: $(XOBJECTS)
60         $(OCAMLFIND) opt $(OCAMLOPTFLAGS) \
61           -linkpkg $(XOBJECTS) -o $@
62 else
63 virt-similarity: $(OBJECTS)
64         $(OCAMLFIND) c $(OCAMLCFLAGS) \
65           -linkpkg $(OBJECTS) -o $@
66 endif
67
68 # Rules for all OCaml files.
69 %.cmi: %.mli
70         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
71 %.cmo: %.ml
72         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
73 %.cmx: %.ml
74         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
75
76 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
77
78 # OCaml dependencies.
79 depend: .depend
80
81 .depend: $(SOURCES)
82         rm -f $@ $@-t
83         $(OCAMLFIND) ocamldep $^ | \
84           $(SED) -e 's/ *$$//' | \
85           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
86           LANG=C sort > $@-t
87         mv $@-t $@
88
89 -include .depend
90
91 # Manual page.
92 man_MANS = virt-similarity.1
93
94 virt-similarity.1: virt-similarity.pod
95         pod2man \
96           -c "Virtualization Tools" \
97           --release "$(PACKAGE)-$(VERSION)" \
98           --section 1 \
99           --stderr --utf8 \
100           $< > $@
101
102 rpm: dist
103         rpmbuild -ta $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
104
105 licensecheck:
106         licensecheck $$(git ls-files)