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@
34 ifneq ($(pkg_gettext),no)
35 OBJS := virt_ctrl_gettext.cmo
42 vc_connection_dlg.cmo \
46 # Good, we have ocamlfind.
47 OCAMLCPACKAGES := -I ../libvirt -package unix,lablgtk2
48 ifeq ($(pkg_dbus),yes)
49 OCAMLCPACKAGES += -package dbus
52 ifeq ($(pkg_gettext),yes)
53 OCAMLCPACKAGES += -package gettext-stub
56 OCAMLCLIBS := -linkpkg
57 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
59 OCAMLOPTLIBS := $(OCAMLCLIBS)
61 # Bad boy, please install ocamlfind.
62 OCAMLCINCS := -I ../libvirt -I @pkg_lablgtk2@
64 OCAMLCLIBS := unix.cma lablgtk.cma
65 OCAMLOPTINCS := $(OCAMLCINCS)
67 OCAMLOPTLIBS := unix.cmxa lablgtk.cmxa
70 ifneq ($(with_icons),no)
74 export LIBRARY_PATH=../libvirt
75 export LD_LIBRARY_PATH=../libvirt
77 BYTE_TARGETS := virt-ctrl
78 OPT_TARGETS := virt-ctrl.opt
82 XOBJS := $(OBJS:.cmo=.cmx)
90 $(OCAMLFIND) ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
91 ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
93 virt-ctrl.opt: $(XOBJS)
94 $(OCAMLFIND) ocamlopt \
95 $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
96 ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $^
99 $(OCAMLC) $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
100 ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
104 ifneq ($(host_os),mingw32)
105 virt-ctrl.opt: $(XOBJS)
106 $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
107 $(patsubst %,-cclib %,$(LDFLAGS)) \
108 ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $^
110 # On MinGW, use a hacked 'gcc' wrapper which understands the @...
111 # syntax for extending the command line.
112 gcc.exe: mingw-gcc-wrapper.ml
113 $(OCAMLC) unix.cma $< -o $@
115 virt-ctrl.opt: $(XOBJS) gcc.exe
117 $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
118 $(patsubst %,-cclib %,$(LDFLAGS)) \
119 ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $(XOBJS)
123 # Rebuild the icons if newer ones available.
124 ifneq ($(with_icons),no)
126 ifeq ($(HAVE_GDK_PIXBUF_MLSOURCE),gdk-pixbuf-mlsource)
127 vc_icons.ml: rebuild-icons.sh
128 ./rebuild-icons.sh $(icons) > $@
134 if [ -x virt-ctrl.opt ]; then \
135 mkdir -p $(DESTDIR)$(bindir); \
136 $(INSTALL) -m 0755 virt-ctrl.opt $(DESTDIR)$(bindir)/virt-ctrl; \
139 include ../Make.rules