d31cfc4a9084b5b9ab669eac03a67bc5f09d289e
[virt-top.git] / virt-top / Makefile.in
1 # virt-top
2 # Copyright (C) 2007 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 pkg_curses      = @pkg_curses@
29 pkg_xml_light   = @pkg_xml_light@
30 pkg_csv         = @pkg_csv@
31 pkg_calendar    = @pkg_calendar@
32 pkg_calendar2   = @pkg_calendar2@
33
34 OCAMLCPACKAGES  := -package unix,extlib,curses,str
35
36 OBJS            := virt_top_utils.cmo virt_top.cmo
37 ifeq ($(pkg_xml_light),yes)
38 OBJS            += virt_top_xml.cmo
39 OCAMLCPACKAGES  := $(OCAMLCPACKAGES),xml-light
40 endif
41 ifeq ($(pkg_csv),yes)
42 OBJS            += virt_top_csv.cmo
43 OCAMLCPACKAGES  := $(OCAMLCPACKAGES),csv
44 endif
45 ifneq ($(pkg_calendar),)
46 OBJS            += virt_top_calendar1.cmo
47 OCAMLCPACKAGES  := $(OCAMLCPACKAGES),calendar
48 endif
49 ifneq ($(pkg_calendar2),)
50 OBJS            += virt_top_calendar2.cmo
51 OCAMLCPACKAGES  := $(OCAMLCPACKAGES),calendar
52 endif
53 OBJS            += virt_top_main.cmo
54
55 XOBJS           := $(OBJS:.cmo=.cmx)
56
57 OCAMLCPACKAGES  += -I ../libvirt
58 OCAMLCFLAGS     := -g -w s
59 OCAMLCLIBS      := -linkpkg
60
61 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
62 OCAMLOPTFLAGS   := -w s
63 OCAMLOPTLIBS    := $(OCAMLCLIBS)
64
65 export LIBRARY_PATH=../libvirt
66 export LD_LIBRARY_PATH=../libvirt
67
68 BYTE_TARGETS    := virt-top
69 OPT_TARGETS     := virt-top.opt
70
71 ifeq ($(HAVE_PERLDOC),perldoc)
72 BYTE_TARGETS    += virt-top.1 virt-top.txt
73 endif
74
75 all: $(BYTE_TARGETS)
76
77 opt: $(OPT_TARGETS)
78
79 virt-top: $(OBJS)
80         ocamlfind ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
81           ../libvirt/mllibvirt.cma -o $@ $^
82
83 virt-top.opt: $(XOBJS)
84         ocamlfind ocamlopt \
85           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
86           ../libvirt/mllibvirt.cmxa -cclib -lncurses -o $@ $^
87
88 # Manual page.
89 ifeq ($(HAVE_PERLDOC),perldoc)
90 virt-top.1: virt-top.pod
91         pod2man -c "Virtualization Support" --release "$(PACKAGE)-$(VERSION)" \
92                 $< > $@
93
94 virt-top.txt: virt-top.pod
95         pod2text $< > $@
96 endif
97
98 install:
99         if [ -x virt-top.opt ]; then \
100           mkdir -p $(DESTDIR)$(bindir); \
101           $(INSTALL) -m 0755 virt-top.opt $(DESTDIR)$(bindir)/virt-top; \
102         fi
103
104 include ../Make.rules