1 # virt-ctrl (originally called mlvirtmanager)
2 # Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones
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.
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.
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.
21 exec_prefix = @exec_prefix@
24 with_icons = @with_icons@
27 HAVE_GDK_PIXBUF_MLSOURCE = @HAVE_GDK_PIXBUF_MLSOURCE@
30 pkg_gettext = @pkg_gettext@
32 OCAMLFIND = @OCAMLFIND@
35 virt_ctrl_gettext.cmo \
39 vc_connection_dlg.cmo \
43 # Good, we have ocamlfind.
44 OCAMLCPACKAGES := -I ../libvirt -package unix,lablgtk2
45 ifeq ($(pkg_dbus),yes)
46 OCAMLCPACKAGES += -package dbus
49 ifeq ($(pkg_gettext),yes)
50 OCAMLCPACKAGES += -package gettext-stub
53 OCAMLCLIBS := -linkpkg
54 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
56 OCAMLOPTLIBS := $(OCAMLCLIBS)
58 # Bad boy, please install ocamlfind.
59 OCAMLCINCS := -I ../libvirt -I @pkg_lablgtk2@
61 OCAMLCLIBS := unix.cma lablgtk.cma
62 OCAMLOPTINCS := $(OCAMLCINCS)
64 OCAMLOPTLIBS := unix.cmxa lablgtk.cmxa
67 ifneq ($(with_icons),no)
71 export LIBRARY_PATH=../libvirt
72 export LD_LIBRARY_PATH=../libvirt
74 BYTE_TARGETS := virt-ctrl
75 OPT_TARGETS := virt-ctrl.opt
79 XOBJS := $(OBJS:.cmo=.cmx)
87 $(OCAMLFIND) ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
88 ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
90 virt-ctrl.opt: $(XOBJS)
91 $(OCAMLFIND) ocamlopt \
92 $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
93 ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $^
96 $(OCAMLC) $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
97 ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
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 $@ $^
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 $@
112 virt-ctrl.opt: $(XOBJS) gcc.exe
114 $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
115 $(patsubst %,-cclib %,$(LDFLAGS)) \
116 ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $(XOBJS)
120 # Rebuild the icons if newer ones available.
121 ifneq ($(with_icons),no)
123 ifeq ($(HAVE_GDK_PIXBUF_MLSOURCE),gdk-pixbuf-mlsource)
124 vc_icons.ml: rebuild-icons.sh
125 ./rebuild-icons.sh $(icons) > $@
131 if [ -x virt-ctrl.opt ]; then \
132 mkdir -p $(DESTDIR)$(bindir); \
133 $(INSTALL) -m 0755 virt-ctrl.opt $(DESTDIR)$(bindir)/virt-ctrl; \
136 include ../Make.rules