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