6a13bef6efbc4727e55ef6aed03de9042befea32
[virt-top.git] / src / Makefile.in
1 # virt-top
2 # Copyright (C) 2007-2014 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 PACKAGE         := @PACKAGE_NAME@
19 VERSION         := @PACKAGE_VERSION@
20
21 INSTALL         := @INSTALL@
22 HAVE_PERLDOC    := @HAVE_PERLDOC@
23
24 prefix          = @prefix@
25 exec_prefix     = @exec_prefix@
26 bindir          = @bindir@
27
28 OCAML_PKG_curses    = @OCAML_PKG_curses@
29 OCAML_PKG_xml_light = @OCAML_PKG_xml_light@
30 OCAML_PKG_csv       = @OCAML_PKG_csv@
31 OCAML_PKG_calendar  = @OCAML_PKG_calendar@
32 OCAML_PKG_gettext   = @OCAML_PKG_gettext@
33
34 OCAMLCPACKAGES  := -package unix,extlib,curses,str,libvirt
35
36 ifneq ($(OCAML_PKG_gettext),no)
37 OCAMLCPACKAGES  += -package gettext-stub
38 endif
39
40 OBJS            := \
41                    version.cmo \
42                    opt_gettext.cmo \
43                    utils.cmo \
44                    types.cmo \
45                    collect.cmo \
46                    screen.cmo \
47                    redraw.cmo \
48                    csv_output.cmo \
49                    stream_output.cmo \
50                    top.cmo
51 ifneq ($(OCAML_PKG_xml_light),no)
52 OBJS            += opt_xml.cmo
53 OCAMLCPACKAGES  += -package xml-light
54 endif
55 ifneq ($(OCAML_PKG_csv),no)
56 OBJS            += opt_csv.cmo
57 OCAMLCPACKAGES  += -package csv
58 endif
59 ifneq ($(OCAML_PKG_calendar),no)
60 OBJS            += opt_calendar.cmo
61 OCAMLCPACKAGES  += -package calendar
62 endif
63 OBJS            += main.cmo
64
65 XOBJS           := $(OBJS:.cmo=.cmx)
66
67 OCAMLCFLAGS     := -g -warn-error CDEFLMPSUVYZX-3
68 OCAMLCLIBS      := -linkpkg
69
70 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
71 OCAMLOPTFLAGS   := $(OCAMLCFLAGS)
72 OCAMLOPTLIBS    := $(OCAMLCLIBS)
73
74 BYTE_TARGETS    := virt-top
75 OPT_TARGETS     := virt-top.opt
76
77 ifeq ($(HAVE_PERLDOC),perldoc)
78 BYTE_TARGETS    += virt-top.1 virt-top.txt
79 OPT_TARGETS     += virt-top.1 virt-top.txt
80 endif
81
82 all: $(BYTE_TARGETS)
83
84 opt: $(OPT_TARGETS)
85
86 virt-top: $(OBJS)
87         ocamlfind ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) -o $@ $^
88
89 virt-top.opt: $(XOBJS)
90         ocamlfind ocamlopt \
91           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
92           -o $@ $^
93
94 # Manual page.
95 ifeq ($(HAVE_PERLDOC),perldoc)
96 virt-top.1: virt-top.pod
97         pod2man -c "Virtualization Support" --release "$(PACKAGE)-$(VERSION)" \
98                 $< > $@
99
100 virt-top.txt: virt-top.pod
101         pod2text $< > $@
102 endif
103
104 install:
105         if [ -x virt-top.opt ]; then \
106           mkdir -p $(DESTDIR)$(bindir); \
107           $(INSTALL) -m 0755 virt-top.opt $(DESTDIR)$(bindir)/virt-top; \
108         fi
109
110 include ../Make.rules