6d684377ac9595f7b5267cbccec357ee559f5ce0
[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 pkg_dbus        = @pkg_dbus@
25
26 OCAMLFIND       = @OCAMLFIND@
27
28 OBJS := \
29         vc_helpers.cmo \
30         vc_connections.cmo \
31         vc_domain_ops.cmo \
32         vc_connection_dlg.cmo \
33         vc_mainwindow.cmo
34
35 ifneq ($(OCAMLFIND),)
36 OCAMLCPACKAGES  := -I ../libvirt -package unix,lablgtk2
37 ifeq ($(pkg_dbus),yes)
38 OCAMLCPACKAGES  := $(OCAMLCPACKAGES),dbus
39 OBJS            += vc_dbus.cmo
40 endif
41 OCAMLCFLAGS     := -g
42 OCAMLCLIBS      := -linkpkg
43 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
44 OCAMLOPTFLAGS   :=
45 OCAMLOPTLIBS    := $(OCAMLCLIBS)
46 else
47 OCAMLCINCS      := -I ../libvirt -I @pkg_lablgtk2@
48 OCAMLCFLAGS     := -g
49 OCAMLCLIBS      := unix.cma lablgtk.cma
50 OCAMLOPTINCS    := $(OCAMLCINCS)
51 OCAMLOPTFLAGS   :=
52 OCAMLOPTLIBS    := unix.cmxa lablgtk.cmxa
53 endif
54
55 export LIBRARY_PATH=../libvirt
56 export LD_LIBRARY_PATH=../libvirt
57
58 BYTE_TARGETS    := virt-ctrl
59 OPT_TARGETS     := virt-ctrl.opt
60
61 OBJS += virt_ctrl.cmo
62
63 XOBJS := $(OBJS:.cmo=.cmx)
64
65 all: $(BYTE_TARGETS)
66
67 opt: $(OPT_TARGETS)
68
69 ifneq ($(OCAMLFIND),)
70 virt-ctrl: $(OBJS)
71         $(OCAMLFIND) ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
72           ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
73
74 virt-ctrl.opt: $(XOBJS)
75         $(OCAMLFIND) ocamlopt \
76           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
77           ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $^
78 else
79 virt-ctrl: $(OBJS)
80         $(OCAMLC) $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
81           ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
82
83 host_os         = @host_os@
84
85 ifneq ($(host_os),mingw32)
86 virt-ctrl.opt: $(XOBJS)
87         $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
88           $(patsubst %,-cclib %,$(LDFLAGS)) \
89           ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $^
90 else
91 # On MinGW, use a hacked 'gcc' wrapper which understands the @...
92 # syntax for extending the command line.
93 gcc.exe: mingw-gcc-wrapper.ml
94         $(OCAMLC) unix.cma $< -o $@
95
96 virt-ctrl.opt: $(XOBJS) gcc.exe
97         PATH=.:$$PATH \
98         $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
99           $(patsubst %,-cclib %,$(LDFLAGS)) \
100           ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $(XOBJS)
101 endif
102 endif
103
104 install:
105         if [ -x virt-ctrl.opt ]; then \
106           mkdir -p $(DESTDIR)$(bindir); \
107           $(INSTALL) -m 0755 virt-ctrl.opt $(DESTDIR)$(bindir)/virt-ctrl; \
108         fi
109
110 include ../Make.rules