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