Remove dependency on ocaml-extlib
[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_csv.ml \
31         opt_gettext.ml \
32         opt_xml.ml \
33         redraw.ml \
34         redraw.mli \
35         screen.ml \
36         screen.mli \
37         stream_output.ml \
38         stream_output.mli \
39         top.ml \
40         top.mli \
41         types.ml \
42         types.mli \
43         utils.ml \
44         utils.mli \
45         version.ml \
46         virt-top.pod
47
48 OCAMLPACKAGES = -package unix,curses,str,libvirt
49
50 if HAVE_PKG_GETTEXT
51 OCAMLPACKAGES  += -package gettext-stub
52 endif
53
54 BOBJS = \
55         version.cmo \
56         opt_gettext.cmo \
57         utils.cmo \
58         types.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_XML_LIGHT
66 BOBJS += opt_xml.cmo
67 OCAMLPACKAGES += -package xml-light
68 endif
69 if HAVE_PKG_CSV
70 BOBJS += opt_csv.cmo
71 OCAMLPACKAGES += -package csv
72 endif
73 if HAVE_PKG_CALENDAR
74 BOBJS += opt_calendar.cmo
75 OCAMLPACKAGES += -package calendar
76 endif
77 BOBJS += main.cmo
78
79 XOBJS = $(BOBJS:.cmo=.cmx)
80
81 OCAMLFLAGS = -g -warn-error +C+D+E+F+L+M+P+S+U+V+Y+Z+X-3 -ccopt '@CFLAGS@'
82 OCAMLLIBS =
83
84 bin_PROGRAMS = virt-top
85
86 virt_top_SOURCES = dummy.c
87
88 if !HAVE_OCAMLOPT
89 OBJECTS = $(BOBJS)
90 else
91 OBJECTS = $(XOBJS)
92 endif
93
94 virt_top_DEPENDENCIES = $(OBJECTS)
95 virt_top_LINK = \
96         ../ocaml-link.sh -cclib '$(OCAMLLIBS)' -- \
97           $(OCAMLFIND) $(OCAMLBEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) \
98           $(OBJECTS) -o $@
99
100 .mli.cmi:
101         $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
102 .ml.cmo:
103         $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
104 .ml.cmx:
105         $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
106
107 # Dependencies.
108 .depend: $(srcdir)/*.ml $(srcdir)/*.mli
109         ../ocaml-dep.sh $^
110 -include .depend
111
112 # Manual page.
113 if HAVE_PERLDOC
114
115 virt-top.1: virt-top.pod
116         pod2man -u --section 1 -c "Virtualization Support" \
117                 --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
118                 $< > $@
119
120 virt-top.txt: virt-top.pod
121         pod2text $< > $@
122
123 CLEANFILES += virt-top.1 virt-top.txt
124
125 endif