5e54923ed383e16bf8431f943e5a1e3d52559560
[virt-df.git] / lib / Makefile.in
1 # Diskimage library.
2 # @configure_input@
3 # Copyright (C) 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 OCAML_WORD_SIZE := @OCAML_WORD_SIZE@
26
27 prefix          = @prefix@
28 exec_prefix     = @exec_prefix@
29 bindir          = @bindir@
30
31 OCAMLCPACKAGES  := -package unix,extlib,bitmatch.syntax
32
33 #----------------------------------------------------------------------
34 # Build up the list of object files.
35
36 OBJS            := int63.cmo \
37                    diskimage_impl.cmo
38
39 # Plugin objects.
40 OBJS            += diskimage_ext2.cmo \
41                    diskimage_linux_swap.cmo \
42                    diskimage_linux_swsuspend.cmo \
43                    diskimage_fat.cmo \
44                    diskimage_ntfs.cmo \
45                    diskimage_lvm2_metadata.cmo \
46                    diskimage_lvm2_parser.cmo \
47                    diskimage_lvm2_lexer.cmo \
48                    diskimage_lvm2.cmo \
49                    diskimage_mbr.cmo
50
51 OBJS            += diskimage.cmo
52
53 XOBJS           := $(OBJS:.cmo=.cmx)
54
55 #----------------------------------------------------------------------
56
57 SYNTAX          := -syntax bitmatch.syntax
58
59 OCAMLCFLAGS     := @OCAMLCFLAGS@ $(SYNTAX)
60 OCAMLCLIBS      := -linkpkg
61
62 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
63 OCAMLOPTFLAGS   := @OCAMLOPTFLAGS@ $(SYNTAX)
64 OCAMLOPTLIBS    := $(OCAMLCLIBS)
65
66 OCAMLDEPFLAGS   := $(SYNTAX)
67
68 BYTE_TARGETS    := diskimage.cma
69 OPT_TARGETS     := diskimage.cmxa
70
71 all: $(BYTE_TARGETS)
72
73 opt: $(OPT_TARGETS)
74
75 diskimage.cma: $(OBJS)
76         ocamlfind ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
77           -a -o $@ $^
78
79 diskimage.cmxa: $(XOBJS)
80         ocamlfind ocamlopt \
81           $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) \
82           -a -o $@ $^
83
84 # 'make depend' doesn't catch these dependencies because the .mli file
85 # is auto-generated.
86 diskimage_lvm2_parser.cmo: diskimage_lvm2_parser.cmi
87 diskimage_lvm2_parser.cmx: diskimage_lvm2_parser.cmi
88 diskimage_lvm2_parser.cmi: diskimage_lvm2_parser.mli
89
90 diskimage_lvm2_lexer.cmo: diskimage_impl.cmi
91 diskimage_lvm2_parser.cmo: diskimage_impl.cmi
92 diskimage_lvm2_lexer.cmx: diskimage_impl.cmi
93 diskimage_lvm2_parser.cmx: diskimage_impl.cmi
94
95 # Int63 module is defined differently on 32 and 64 bit platforms.
96 int63.ml: int63_on_$(OCAML_WORD_SIZE).ml Makefile
97         rm -f $@
98         echo "(* WARNING: THIS FILE IS GENERATED FROM $< *)" | \
99         cat - $< > $@
100
101 int63.mli: int63_on_$(OCAML_WORD_SIZE).mli Makefile
102         rm -f $@
103         echo "(* WARNING: THIS FILE IS GENERATED FROM $< *)" | \
104         cat - $< > $@
105
106 int63.cmo: int63.cmi
107 int63.cmx: int63.cmi
108 int63.cmi: int63.ml int63.mli
109
110 #test_int63.opt: int63.cmx test_int63.cmx
111 #       $(OCAMLFIND) ocamlopt $^ -o $@
112
113 install:
114         ocamlfind install diskimage META *.mli *.cma *.cmx *.cmxa *.a
115
116 include ../Make.rules