src: Include <libxml/parser.h>
[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         main.ml \
28         opt_calendar.ml \
29         opt_gettext.ml \
30         redraw.ml \
31         redraw.mli \
32         screen.ml \
33         screen.mli \
34         stream_output.ml \
35         stream_output.mli \
36         top.ml \
37         top.mli \
38         types.ml \
39         types.mli \
40         utils.ml \
41         utils.mli \
42         version.ml \
43         virt-top.pod \
44         xml-c.c \
45         xml.ml
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         xml.cmo \
59         collect.cmo \
60         screen.cmo \
61         redraw.cmo \
62         csv_output.cmo \
63         stream_output.cmo \
64         top.cmo
65 if HAVE_PKG_CALENDAR
66 BOBJS += opt_calendar.cmo
67 OCAMLPACKAGES += -package calendar
68 endif
69 BOBJS += main.cmo
70
71 XOBJS = $(BOBJS:.cmo=.cmx)
72
73 OCAMLFLAGS = \
74         -g \
75         -warn-error +C+D+E+F+L+M+P+S+U+V+Y+Z+X-3 \
76         -ccopt '$(CFLAGS)'
77 OCAMLLIBS = $(LIBXML2_LIBS)
78
79 bin_PROGRAMS = virt-top
80
81 virt_top_SOURCES = xml-c.c
82 virt_top_CFLAGS = \
83         $(LIBXML2_CFLAGS) \
84         -I$(libdir)/ocaml
85
86 if !HAVE_OCAMLOPT
87 OBJECTS = $(BOBJS)
88 else
89 OBJECTS = $(XOBJS)
90 endif
91
92 virt_top_DEPENDENCIES = $(OBJECTS)
93 virt_top_LINK = \
94         ../ocaml-link.sh -cclib '$(OCAMLLIBS)' -- \
95           $(OCAMLFIND) $(OCAMLBEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) \
96           $(OBJECTS) -o $@
97
98 .mli.cmi:
99         $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
100 .ml.cmo:
101         $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
102 .ml.cmx:
103         $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
104
105 # Dependencies.
106 .depend: $(srcdir)/*.ml $(srcdir)/*.mli
107         ../ocaml-dep.sh $^
108 -include .depend
109
110 # Manual page.
111 if HAVE_PERLDOC
112
113 virt-top.1: virt-top.pod
114         pod2man -u --section 1 -c "Virtualization Support" \
115                 --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
116                 $< > $@
117
118 virt-top.txt: virt-top.pod
119         pod2text $< > $@
120
121 CLEANFILES += virt-top.1 virt-top.txt
122
123 endif