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@
31 OCAMLFIND = @OCAMLFIND@
37 vc_connection_dlg.cmo \
41 # Good, we have ocamlfind.
42 OCAMLCPACKAGES := -I ../libvirt -package unix,lablgtk2
43 ifeq ($(pkg_dbus),yes)
44 OCAMLCPACKAGES := $(OCAMLCPACKAGES),dbus
48 OCAMLCLIBS := -linkpkg
49 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
51 OCAMLOPTLIBS := $(OCAMLCLIBS)
53 # Bad boy, please install ocamlfind.
54 OCAMLCINCS := -I ../libvirt -I @pkg_lablgtk2@
56 OCAMLCLIBS := unix.cma lablgtk.cma
57 OCAMLOPTINCS := $(OCAMLCINCS)
59 OCAMLOPTLIBS := unix.cmxa lablgtk.cmxa
62 ifneq ($(with_icons),no)
66 export LIBRARY_PATH=../libvirt
67 export LD_LIBRARY_PATH=../libvirt
69 BYTE_TARGETS := virt-ctrl
70 OPT_TARGETS := virt-ctrl.opt
74 XOBJS := $(OBJS:.cmo=.cmx)
82 $(OCAMLFIND) ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
83 ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
85 virt-ctrl.opt: $(XOBJS)
86 $(OCAMLFIND) ocamlopt \
87 $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
88 ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $^
91 $(OCAMLC) $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
92 ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
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 $@ $^
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 $@
107 virt-ctrl.opt: $(XOBJS) gcc.exe
109 $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
110 $(patsubst %,-cclib %,$(LDFLAGS)) \
111 ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $(XOBJS)
115 # Rebuild the icons if newer ones available.
116 ifneq ($(with_icons),no)
118 ifeq ($(HAVE_GDK_PIXBUF_MLSOURCE),gdk-pixbuf-mlsource)
119 vc_icons.ml: rebuild-icons.sh
120 ./rebuild-icons.sh $(icons) > $@
126 if [ -x virt-ctrl.opt ]; then \
127 mkdir -p $(DESTDIR)$(bindir); \
128 $(INSTALL) -m 0755 virt-ctrl.opt $(DESTDIR)$(bindir)/virt-ctrl; \
131 include ../Make.rules