837bb99d89f34c99641a9c6266b0934afbb1e1ae
[virt-df.git] / virt-df / Makefile.in
1 # virt-df
2 # Copyright (C) 2007-2008 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 PACKAGE         := @PACKAGE_NAME@
19 VERSION         := @PACKAGE_VERSION@
20
21 INSTALL         := @INSTALL@
22 HAVE_PERLDOC    := @HAVE_PERLDOC@
23
24 prefix          = @prefix@
25 exec_prefix     = @exec_prefix@
26 bindir          = @bindir@
27
28 pkg_gettext     = @pkg_gettext@
29
30 #OCAMLCPACKAGES := -package unix,extlib,xml-light,libvirt,bitmatch -I ../lib
31 OCAMLCPACKAGES  := -package unix,extlib,xml-light,libvirt -I +bitmatch -I ../lib
32
33 ifneq ($(pkg_gettext),no)
34 OCAMLCPACKAGES  += -package gettext-stub
35 endif
36
37 #----------------------------------------------------------------------
38 # Build up the list of object files.
39
40 # Library objects.
41 OBJS            := virt_df_gettext.cmo virt_df.cmo
42
43 # Plug-in objects.
44 ifneq ($(pkg_csv),no)
45 OCAMLCPACKAGES  += -package csv
46 OBJS            += virt_df_csv.cmo
47 endif
48
49 # Main program.
50 OBJS            += virt_df_main.cmo
51
52 XOBJS           := $(OBJS:.cmo=.cmx)
53
54 #----------------------------------------------------------------------
55
56 OCAMLCFLAGS     := -g -w s
57 #OCAMLCLIBS     := -linkpkg diskimage.cma
58 OCAMLCLIBS      := -linkpkg bitmatch.cma diskimage.cma
59
60 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
61 OCAMLOPTFLAGS   := -w s
62 #OCAMLOPTLIBS   := -linkpkg diskimage.cmxa
63 OCAMLOPTLIBS    := -linkpkg bitmatch.cmxa diskimage.cmxa
64
65 BYTE_TARGETS    := virt-df
66 OPT_TARGETS     := virt-df.opt
67
68 ifeq ($(HAVE_PERLDOC),perldoc)
69 BYTE_TARGETS    += virt-df.1 virt-df.txt
70 endif
71
72 all: $(BYTE_TARGETS)
73
74 opt: $(OPT_TARGETS)
75
76 virt-df: $(OBJS)
77         ocamlfind ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
78           -o $@ $^
79
80 virt-df.opt: $(XOBJS)
81         ocamlfind ocamlopt \
82           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
83           -o $@ $^
84
85 # Manual page.
86 ifeq ($(HAVE_PERLDOC),perldoc)
87 virt-df.1: virt-df.pod
88         pod2man -c "Virtualization Support" --release "$(PACKAGE)-$(VERSION)" \
89                 $< > $@
90
91 virt-df.txt: virt-df.pod
92         pod2text $< > $@
93 endif
94
95 install:
96         if [ -x virt-df.opt ]; then \
97           mkdir -p $(DESTDIR)$(bindir); \
98           $(INSTALL) -m 0755 virt-df.opt $(DESTDIR)$(bindir)/virt-df; \
99         fi
100
101 include ../Make.rules