Reorganize the code so disk parsing is in a separate library.
[virt-df.git] / lib / Makefile.in
1 # virt-df
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 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 #OCAMLCPACKAGES := -package unix,extlib,bitmatch
29 OCAMLCPACKAGES  := -package unix,extlib -I +bitmatch
30
31 #----------------------------------------------------------------------
32 # Build up the list of object files.
33
34 OBJS            := diskimage_utils.cmo
35
36 # Plugin objects.
37 OBJS            += diskimage_ext2.cmo \
38                    diskimage_linux_swap.cmo \
39                    diskimage_lvm2_metadata.cmo \
40                    diskimage_lvm2_parser.cmo \
41                    diskimage_lvm2_lexer.cmo \
42                    diskimage_lvm2.cmo \
43                    diskimage_mbr.cmo
44
45 OBJS            += diskimage.cmo
46
47 XOBJS           := $(OBJS:.cmo=.cmx)
48
49 #----------------------------------------------------------------------
50
51 SYNTAX          := -pp "camlp4o -I`ocamlc -where`/bitmatch pa_bitmatch.cmo"
52
53 OCAMLCFLAGS     := -g -w s $(SYNTAX)
54 #OCAMLCLIBS     := -linkpkg
55 OCAMLCLIBS      := -linkpkg bitmatch.cma
56
57 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
58 OCAMLOPTFLAGS   := -w s $(SYNTAX)
59 #OCAMLOPTLIBS   := $(OCAMLCLIBS)
60 OCAMLOPTLIBS    := -linkpkg bitmatch.cmxa
61
62 OCAMLDEPFLAGS   := $(SYNTAX)
63
64 BYTE_TARGETS    := diskimage.cma
65 OPT_TARGETS     := diskimage.cmxa
66
67 all: $(BYTE_TARGETS)
68
69 opt: $(OPT_TARGETS)
70
71 diskimage.cma: $(OBJS)
72         ocamlfind ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
73           -a -o $@ $^
74
75 diskimage.cmxa: $(XOBJS)
76         ocamlfind ocamlopt \
77           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
78           -a -o $@ $^
79
80 # 'make depend' doesn't catch these dependencies because the .mli file
81 # is auto-generated.
82 diskimage_lvm2_parser.cmo: diskimage_lvm2_parser.cmi
83 diskimage_lvm2_parser.cmx: diskimage_lvm2_parser.cmi
84 diskimage_lvm2_parser.cmi: diskimage_lvm2_parser.mli
85
86 install:
87         ocamlfind install diskimage *.mli *.cma *.cmx *.cmxa *.a
88
89 include ../Make.rules