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