eb286301d38aea7974b9d0296c756826052e1ca7
[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 with_icons      = @with_icons@
25 icons           = @icons@
26
27 HAVE_GDK_PIXBUF_MLSOURCE = @HAVE_GDK_PIXBUF_MLSOURCE@
28
29 pkg_dbus        = @pkg_dbus@
30 pkg_gettext     = @pkg_gettext@
31
32 OCAMLFIND       = @OCAMLFIND@
33
34 ifneq ($(pkg_gettext),no)
35 OBJS            := virt_ctrl_gettext.cmo
36 endif
37
38 OBJS            += \
39         vc_helpers.cmo \
40         vc_connections.cmo \
41         vc_domain_ops.cmo \
42         vc_connection_dlg.cmo \
43         vc_mainwindow.cmo
44
45 ifneq ($(OCAMLFIND),)
46 # Good, we have ocamlfind.
47 OCAMLCPACKAGES  := -I ../libvirt -package unix,lablgtk2
48 ifeq ($(pkg_dbus),yes)
49 OCAMLCPACKAGES  += -package dbus
50 OBJS            += vc_dbus.cmo
51 endif
52 ifeq ($(pkg_gettext),yes)
53 OCAMLCPACKAGES  += -package gettext-stub
54 endif
55 OCAMLCFLAGS     := -g
56 OCAMLCLIBS      := -linkpkg
57 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
58 OCAMLOPTFLAGS   :=
59 OCAMLOPTLIBS    := $(OCAMLCLIBS)
60 else
61 # Bad boy, please install ocamlfind.
62 OCAMLCINCS      := -I ../libvirt -I @pkg_lablgtk2@
63 OCAMLCFLAGS     := -g
64 OCAMLCLIBS      := unix.cma lablgtk.cma
65 OCAMLOPTINCS    := $(OCAMLCINCS)
66 OCAMLOPTFLAGS   :=
67 OCAMLOPTLIBS    := unix.cmxa lablgtk.cmxa
68 endif
69
70 ifneq ($(with_icons),no)
71 OBJS            += vc_icons.cmo
72 endif
73
74 export LIBRARY_PATH=../libvirt
75 export LD_LIBRARY_PATH=../libvirt
76
77 BYTE_TARGETS    := virt-ctrl
78 OPT_TARGETS     := virt-ctrl.opt
79
80 OBJS += virt_ctrl.cmo
81
82 XOBJS := $(OBJS:.cmo=.cmx)
83
84 all: $(BYTE_TARGETS)
85
86 opt: $(OPT_TARGETS)
87
88 ifneq ($(OCAMLFIND),)
89 virt-ctrl: $(OBJS)
90         $(OCAMLFIND) ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
91           ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
92
93 virt-ctrl.opt: $(XOBJS)
94         $(OCAMLFIND) ocamlopt \
95           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
96           ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $^
97 else
98 virt-ctrl: $(OBJS)
99         $(OCAMLC) $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
100           ../libvirt/mllibvirt.cma gtkInit.cmo -o $@ $^
101
102 host_os         = @host_os@
103
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 $@ $^
109 else
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 $@
114
115 virt-ctrl.opt: $(XOBJS) gcc.exe
116         PATH=.:$$PATH \
117         $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
118           $(patsubst %,-cclib %,$(LDFLAGS)) \
119           ../libvirt/mllibvirt.cmxa gtkInit.cmx -o $@ $(XOBJS)
120 endif
121 endif
122
123 # Rebuild the icons if newer ones available.
124 ifneq ($(with_icons),no)
125 ifneq ($(icons),)
126 ifeq ($(HAVE_GDK_PIXBUF_MLSOURCE),gdk-pixbuf-mlsource)
127 vc_icons.ml: rebuild-icons.sh
128         ./rebuild-icons.sh $(icons) > $@
129 endif
130 endif
131 endif
132
133 install:
134         if [ -x virt-ctrl.opt ]; then \
135           mkdir -p $(DESTDIR)$(bindir); \
136           $(INSTALL) -m 0755 virt-ctrl.opt $(DESTDIR)$(bindir)/virt-ctrl; \
137         fi
138
139 include ../Make.rules