72ad5d76f1bda95bb156923b8e758fa21f7da522
[virt-df.git] / diskzip / Makefile.in
1 # diskzip
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,bitmatch -I ../lib
31 OCAMLCPACKAGES  := -package unix,extlib -I +bitmatch -I ../lib
32
33 ifneq ($(pkg_gettext),no)
34 OCAMLCPACKAGES  += -package gettext-stub
35 endif
36
37 OBJS            := diskzip_gettext.cmo diskzip_bitmap.cmo diskzip.cmo
38 XOBJS           := $(OBJS:.cmo=.cmx)
39
40 SYNTAX          := -pp "camlp4o -I`ocamlc -where`/bitmatch pa_bitmatch.cmo"
41
42 OCAMLCFLAGS     := @OCAMLCFLAGS@ $(SYNTAX)
43 #OCAMLCLIBS     := -linkpkg diskimage.cma
44 OCAMLCLIBS      := -linkpkg bitmatch.cma diskimage.cma
45
46 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
47 OCAMLOPTFLAGS   := @OCAMLOPTFLAGS@ $(SYNTAX)
48 #OCAMLOPTLIBS   := -linkpkg diskimage.cmxa
49 OCAMLOPTLIBS    := -linkpkg bitmatch.cmxa diskimage.cmxa
50
51 OCAMLDEPFLAGS   := $(SYNTAX)
52
53 BYTE_TARGETS    := diskzip
54 OPT_TARGETS     := diskzip.opt
55
56 ifeq ($(HAVE_PERLDOC),perldoc)
57 BYTE_TARGETS    += diskzip.1 diskzip.txt
58 endif
59
60 all: $(BYTE_TARGETS)
61
62 opt: $(OPT_TARGETS)
63
64 diskzip: $(OBJS) ../lib/diskimage.cma
65         ocamlfind ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
66           -o $@ $(OBJS)
67
68 diskzip.opt: $(XOBJS) ../lib/diskimage.cmxa
69         ocamlfind ocamlopt \
70           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
71           -o $@ $(XOBJS)
72
73 # Manual page.
74 ifeq ($(HAVE_PERLDOC),perldoc)
75 diskzip.1: diskzip.pod
76         pod2man -c "Disk images" --release "$(PACKAGE)-$(VERSION)" \
77                 $< > $@
78
79 diskzip.txt: diskzip.pod
80         pod2text $< > $@
81 endif
82
83 install:
84         if [ -x diskzip.opt ]; then \
85           mkdir -p $(DESTDIR)$(bindir); \
86           $(INSTALL) -m 0755 diskzip.opt $(DESTDIR)$(bindir)/diskzip; \
87         fi
88
89 include ../Make.rules