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