625afda10a53d943ba14502e9f054d4ef46061f8
[virt-ctrl.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 OBJS            := \
35         virt_ctrl_gettext.cmo \
36         vc_helpers.cmo \
37         vc_connections.cmo \
38         vc_domain_ops.cmo \
39         vc_connection_dlg.cmo \
40         vc_mainwindow.cmo
41
42 OCAMLCPACKAGES  := -package unix,lablgtk2,libvirt
43 ifeq ($(pkg_dbus),yes)
44 OCAMLCPACKAGES  += -package dbus
45 OBJS            += vc_dbus.cmo
46 endif
47 ifeq ($(pkg_gettext),yes)
48 OCAMLCPACKAGES  += -package gettext-stub
49 endif
50 OCAMLCFLAGS     := -g
51 OCAMLCLIBS      := -linkpkg
52 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
53 OCAMLOPTFLAGS   :=
54 OCAMLOPTLIBS    := $(OCAMLCLIBS)
55
56 ifneq ($(with_icons),no)
57 OBJS            += vc_icons.cmo
58 endif
59
60 BYTE_TARGETS    := virt-ctrl
61 OPT_TARGETS     := virt-ctrl.opt
62
63 OBJS += virt_ctrl.cmo
64
65 XOBJS := $(OBJS:.cmo=.cmx)
66
67 all: $(BYTE_TARGETS)
68
69 opt: $(OPT_TARGETS)
70
71 ifneq ($(OCAMLFIND),)
72 virt-ctrl: $(OBJS)
73         $(OCAMLFIND) ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
74           gtkInit.cmo -o $@ $^
75
76 virt-ctrl.opt: $(XOBJS)
77         $(OCAMLFIND) ocamlopt \
78           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
79           gtkInit.cmx -o $@ $^
80 else
81 virt-ctrl: $(OBJS)
82         $(OCAMLC) $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
83           gtkInit.cmo -o $@ $^
84
85 host_os         = @host_os@
86
87 ifneq ($(host_os),mingw32)
88 virt-ctrl.opt: $(XOBJS)
89         $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
90           $(patsubst %,-cclib %,$(LDFLAGS)) \
91           gtkInit.cmx -o $@ $^
92 else
93 # On MinGW, use a hacked 'gcc' wrapper which understands the @...
94 # syntax for extending the command line.
95 gcc.exe: mingw-gcc-wrapper.ml
96         $(OCAMLC) unix.cma $< -o $@
97
98 virt-ctrl.opt: $(XOBJS) gcc.exe
99         PATH=.:$$PATH \
100         $(OCAMLOPT) $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
101           $(patsubst %,-cclib %,$(LDFLAGS)) \
102           gtkInit.cmx -o $@ $(XOBJS)
103 endif
104 endif
105
106 # Rebuild the icons if newer ones available.
107 ifneq ($(with_icons),no)
108 ifneq ($(icons),)
109 ifeq ($(HAVE_GDK_PIXBUF_MLSOURCE),gdk-pixbuf-mlsource)
110 vc_icons.ml: rebuild-icons.sh
111         ./rebuild-icons.sh $(icons) > $@
112 endif
113 endif
114 endif
115
116 install:
117         if [ -x virt-ctrl.opt ]; then \
118           mkdir -p $(DESTDIR)$(bindir); \
119           $(INSTALL) -m 0755 virt-ctrl.opt $(DESTDIR)$(bindir)/virt-ctrl; \
120         fi
121
122 include ../Make.rules