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