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