Updated MANIFEST.
[virt-top.git] / virt-ctrl / Makefile.in
1 # virt-ctrl (originally called mlvirtmanager)
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 INSTALL         := @INSTALL@
19
20 prefix          = @prefix@
21 exec_prefix     = @exec_prefix@
22 bindir          = @bindir@
23
24 with_icons      = @with_icons@
25 icons           = @icons@
26
27 HAVE_GDK_PIXBUF_MLSOURCE = @HAVE_GDK_PIXBUF_MLSOURCE@
28
29 pkg_dbus        = @pkg_dbus@
30 pkg_gettext     = @pkg_gettext@
31
32 OCAMLFIND       = @OCAMLFIND@
33
34 OBJS            := \
35         virt_ctrl_gettext.cmo \
36         vc_helpers.cmo \
37         vc_connections.cmo \
38         vc_domain_ops.cmo \
39         vc_connection_dlg.cmo \
40         vc_mainwindow.cmo
41
42 ifneq ($(OCAMLFIND),)
43 # Good, we have ocamlfind.
44 OCAMLCPACKAGES  := -I ../libvirt -package unix,lablgtk2
45 ifeq ($(pkg_dbus),yes)
46 OCAMLCPACKAGES  += -package dbus
47 OBJS            += vc_dbus.cmo
48 endif
49 ifeq ($(pkg_gettext),yes)
50 OCAMLCPACKAGES  += -package gettext-stub
51 endif
52 OCAMLCFLAGS     := -g
53 OCAMLCLIBS      := -linkpkg
54 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
55 OCAMLOPTFLAGS   :=
56 OCAMLOPTLIBS    := $(OCAMLCLIBS)
57 else
58 # Bad boy, please install ocamlfind.
59 OCAMLCINCS      := -I ../libvirt -I @pkg_lablgtk2@
60 OCAMLCFLAGS     := -g
61 OCAMLCLIBS      := unix.cma lablgtk.cma
62 OCAMLOPTINCS    := $(OCAMLCINCS)
63 OCAMLOPTFLAGS   :=
64 OCAMLOPTLIBS    := unix.cmxa lablgtk.cmxa
65 endif
66
67 ifneq ($(with_icons),no)
68 OBJS            += vc_icons.cmo
69 endif
70
71 export LIBRARY_PATH=../libvirt
72 export LD_LIBRARY_PATH=../libvirt
73
74 BYTE_TARGETS    := virt-ctrl
75 OPT_TARGETS     := virt-ctrl.opt
76
77 OBJS += virt_ctrl.cmo
78
79 XOBJS := $(OBJS:.cmo=.cmx)
80
81 all: $(BYTE_TARGETS)
82
83 opt: $(OPT_TARGETS)
84
85 ifneq ($(OCAMLFIND),)
86 virt-ctrl: $(OBJS)
87         $(OCAMLFIND) ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
88           ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
89
90 virt-ctrl.opt: $(XOBJS)
91         $(OCAMLFIND) ocamlopt \
92           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
93           ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $^
94 else
95 virt-ctrl: $(OBJS)
96         $(OCAMLC) $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
97           ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
98
99 host_os         = @host_os@
100
101 ifneq ($(host_os),mingw32)
102 virt-ctrl.opt: $(XOBJS)
103         $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
104           $(patsubst %,-cclib %,$(LDFLAGS)) \
105           ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $^
106 else
107 # On MinGW, use a hacked 'gcc' wrapper which understands the @...
108 # syntax for extending the command line.
109 gcc.exe: mingw-gcc-wrapper.ml
110         $(OCAMLC) unix.cma $< -o $@
111
112 virt-ctrl.opt: $(XOBJS) gcc.exe
113         PATH=.:$$PATH \
114         $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
115           $(patsubst %,-cclib %,$(LDFLAGS)) \
116           ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $(XOBJS)
117 endif
118 endif
119
120 # Rebuild the icons if newer ones available.
121 ifneq ($(with_icons),no)
122 ifneq ($(icons),)
123 ifeq ($(HAVE_GDK_PIXBUF_MLSOURCE),gdk-pixbuf-mlsource)
124 vc_icons.ml: rebuild-icons.sh
125         ./rebuild-icons.sh $(icons) > $@
126 endif
127 endif
128 endif
129
130 install:
131         if [ -x virt-ctrl.opt ]; then \
132           mkdir -p $(DESTDIR)$(bindir); \
133           $(INSTALL) -m 0755 virt-ctrl.opt $(DESTDIR)$(bindir)/virt-ctrl; \
134         fi
135
136 include ../Make.rules