build: Remove bogus directory list in ocaml-dep.sh.in
[virt-top.git] / src / Makefile.am
1 # virt-top
2 # Copyright (C) 2007-2021 Red Hat Inc., Richard W.M. Jones
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 CLEANFILES = *~ *.bak *.orig *.rej
19 CLEANFILES += *.cmi *.cmo *.cma *.cmx *.cmxa dll*.so *.a *.annot
20
21 EXTRA_DIST = \
22         .depend \
23         collect.ml \
24         collect.mli \
25         csv_output.ml \
26         csv_output.mli \
27         dummy.c \
28         main.ml \
29         opt_calendar.ml \
30         opt_gettext.ml \
31         opt_xml.ml \
32         redraw.ml \
33         redraw.mli \
34         screen.ml \
35         screen.mli \
36         stream_output.ml \
37         stream_output.mli \
38         top.ml \
39         top.mli \
40         types.ml \
41         types.mli \
42         utils.ml \
43         utils.mli \
44         version.ml \
45         virt-top.pod
46
47 OCAMLPACKAGES = -package unix,curses,str,libvirt
48
49 if HAVE_PKG_GETTEXT
50 OCAMLPACKAGES  += -package gettext-stub
51 endif
52
53 BOBJS = \
54         version.cmo \
55         opt_gettext.cmo \
56         utils.cmo \
57         types.cmo \
58         collect.cmo \
59         screen.cmo \
60         redraw.cmo \
61         csv_output.cmo \
62         stream_output.cmo \
63         top.cmo
64 if HAVE_PKG_XML_LIGHT
65 BOBJS += opt_xml.cmo
66 OCAMLPACKAGES += -package xml-light
67 endif
68 if HAVE_PKG_CALENDAR
69 BOBJS += opt_calendar.cmo
70 OCAMLPACKAGES += -package calendar
71 endif
72 BOBJS += main.cmo
73
74 XOBJS = $(BOBJS:.cmo=.cmx)
75
76 OCAMLFLAGS = -g -warn-error +C+D+E+F+L+M+P+S+U+V+Y+Z+X-3 -ccopt '@CFLAGS@'
77 OCAMLLIBS =
78
79 bin_PROGRAMS = virt-top
80
81 virt_top_SOURCES = dummy.c
82
83 if !HAVE_OCAMLOPT
84 OBJECTS = $(BOBJS)
85 else
86 OBJECTS = $(XOBJS)
87 endif
88
89 virt_top_DEPENDENCIES = $(OBJECTS)
90 virt_top_LINK = \
91         ../ocaml-link.sh -cclib '$(OCAMLLIBS)' -- \
92           $(OCAMLFIND) $(OCAMLBEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) \
93           $(OBJECTS) -o $@
94
95 .mli.cmi:
96         $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
97 .ml.cmo:
98         $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
99 .ml.cmx:
100         $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
101
102 # Dependencies.
103 .depend: $(srcdir)/*.ml $(srcdir)/*.mli
104         ../ocaml-dep.sh $^
105 -include .depend
106
107 # Manual page.
108 if HAVE_PERLDOC
109
110 virt-top.1: virt-top.pod
111         pod2man -u --section 1 -c "Virtualization Support" \
112                 --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
113                 $< > $@
114
115 virt-top.txt: virt-top.pod
116         pod2text $< > $@
117
118 CLEANFILES += virt-top.1 virt-top.txt
119
120 endif