bd5d55ffa59c5704b118dde7eea494cb66926840
[virt-df.git] / virt-df / Makefile.in
1 # virt-df
2 # @configure_input@
3 # Copyright (C) 2007-2008 Red Hat Inc., Richard W.M. Jones
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 PACKAGE         := @PACKAGE_NAME@
20 VERSION         := @PACKAGE_VERSION@
21
22 INSTALL         := @INSTALL@
23 HAVE_PERLDOC    := @HAVE_PERLDOC@
24
25 prefix          = @prefix@
26 exec_prefix     = @exec_prefix@
27 bindir          = @bindir@
28
29 pkg_gettext     = @pkg_gettext@
30
31 OCAMLCPACKAGES  := -package unix,extlib,xml-light,libvirt,bitmatch.syntax,bitmatch -I ../lib
32
33 ifneq ($(pkg_gettext),no)
34 OCAMLCPACKAGES  += -package gettext-stub
35 endif
36
37 OCAMLDOCFLAGS   := -I +extlib -I +bitmatch -I +libvirt -I +xml-light \
38                   -I +csv -I +gettext -I +gettext-stub -I ../lib
39 OCAMLDOCFILES   := $(wildcard *.mli) $(wildcard *.ml)
40
41 #----------------------------------------------------------------------
42 # Build up the list of object files.
43
44 # Library objects.
45 OBJS            := virt_df_gettext.cmo virt_df_version.cmo virt_df.cmo
46
47 # Plug-in objects.
48 ifneq ($(pkg_csv),no)
49 OCAMLCPACKAGES  += -package csv
50 OBJS            += virt_df_csv.cmo
51 endif
52
53 # Main program.
54 OBJS            += virt_df_main.cmo
55
56 XOBJS           := $(OBJS:.cmo=.cmx)
57
58 #----------------------------------------------------------------------
59
60 OCAMLCFLAGS     := @OCAMLCFLAGS@
61 OCAMLCLIBS      := -linkpkg diskimage.cma
62
63 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
64 OCAMLOPTFLAGS   := @OCAMLOPTFLAGS@
65 OCAMLOPTLIBS    := -linkpkg diskimage.cmxa
66
67 BYTE_TARGETS    := virt-df
68 OPT_TARGETS     := virt-df.opt
69
70 ifeq ($(HAVE_PERLDOC),perldoc)
71 BYTE_TARGETS    += virt-df.1 virt-df.txt
72 endif
73
74 all: $(BYTE_TARGETS)
75
76 opt: $(OPT_TARGETS)
77
78 virt-df: $(OBJS) ../lib/diskimage.cma
79         ocamlfind ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
80           -o $@ $(OBJS)
81
82 virt-df.opt: $(XOBJS) ../lib/diskimage.cmxa
83         ocamlfind ocamlopt \
84           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
85           -o $@ $(XOBJS)
86
87 # Manual page.
88 ifeq ($(HAVE_PERLDOC),perldoc)
89 virt-df.1: virt-df.pod
90         pod2man -c "Virtualization Support" --release "$(PACKAGE)-$(VERSION)" \
91                 $< > $@
92
93 virt-df.txt: virt-df.pod
94         pod2text $< > $@
95 endif
96
97 install:
98         if [ -x virt-df.opt ]; then \
99           mkdir -p $(DESTDIR)$(bindir); \
100           $(INSTALL) -m 0755 virt-df.opt $(DESTDIR)$(bindir)/virt-df; \
101         fi
102
103 include ../Make.rules