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