Switch all the links to https
[ocaml-libvirt.git] / libvirt / Makefile.in
1 # ocaml-libvirt
2 # Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
8 #
9 # This library 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 GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
18 WIN32           = @WIN32@
19
20 CFLAGS          = @CFLAGS@ \
21                    -I.. \
22                    -I"$(shell ocamlc -where)" \
23                    @DEBUG@ @WARNINGS@ @CFLAGS_FPIC@
24 LDFLAGS         = @LDFLAGS@
25 #                  -L"$(shell ocamlc -where)"
26
27 OCAMLC          = @OCAMLC@
28 OCAMLOPT        = @OCAMLOPT@
29 OCAMLFIND       = @OCAMLFIND@
30 OCAMLMKLIB      = @OCAMLMKLIB@
31 PERL            = @PERL@
32
33 ifneq ($(OCAMLFIND),)
34 OCAMLCPACKAGES  := -package unix
35 OCAMLCFLAGS     := -g -warn-error CDEFLMPSUVYZX-3 -safe-string
36 OCAMLCLIBS      := -linkpkg
37 else
38 OCAMLCINCS      :=
39 OCAMLCFLAGS     := -g -warn-error CDEFLMPSUVYZX-3 -safe-string
40 OCAMLCLIBS      := unix.cma
41 endif
42
43 OCAMLOPTFLAGS   := $(OCAMLCFLAGS)
44 ifneq ($(OCAMLFIND),)
45 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
46 OCAMLOPTLIBS    := $(OCAMLCLIBS)
47 else
48 OCAMLOPTINCS    := $(OCAMLCINCS)
49 OCAMLOPTLIBS    := unix.cmxa
50 endif
51
52 export LIBRARY_PATH=.
53 export LD_LIBRARY_PATH=.
54
55 BYTE_TARGETS    := mllibvirt.cma
56 OPT_TARGETS     := mllibvirt.cmxa
57
58 all: $(BYTE_TARGETS)
59
60 opt: $(OPT_TARGETS)
61
62 COBJS := libvirt.cmo libvirt_version.cmo
63 OPTOBJS := libvirt.cmx libvirt_version.cmx
64
65 ifneq ($(OCAMLMKLIB),)
66 # Good, we can just use ocamlmklib
67 mllibvirt.cma: libvirt_c.o $(COBJS)
68         $(OCAMLMKLIB) -o mllibvirt $^ $(LDFLAGS) -lvirt
69
70 mllibvirt.cmxa: libvirt_c.o $(OPTOBJS)
71         $(OCAMLMKLIB) -o mllibvirt $^ $(LDFLAGS) -lvirt
72
73 else
74 ifeq ($(WIN32),yes)
75 # Ugh, MinGW doesn't have ocamlmklib.  This technique is copied from the
76 # example in OCaml distribution, otherlibs/win32unix/Makefile.nt
77
78 mllibvirt.cma: dllmllibvirt.dll libmllibvirt.a $(COBJS)
79         $(OCAMLC) -a -linkall -o $@ $(COBJS) \
80           -dllib -lmllibvirt -cclib -lmllibvirt -cclib "$(LDFLAGS) -lvirt"
81
82 mllibvirt.cmxa: libmllibvirt.a $(OPTOBJS)
83         $(OCAMLOPT) -a -linkall -o $@ $(OPTOBJS) \
84           -cclib -lmllibvirt -cclib "$(LDFLAGS) -lvirt"
85
86 dllmllibvirt.dll: libvirt_c.o
87         $(CC) -shared -o $@ $^ \
88           $(LDFLAGS) "$(shell ocamlc -where)"/ocamlrun.a -lvirt
89
90 libmllibvirt.a: libvirt_c.o
91         ar rc $@ $^
92         ranlib $@
93
94 else
95 # Don't know how to build a library on this platform.
96 $(BYTE_TARGETS) $(OPT_TARGETS):
97         echo "Error: ocamlmklib missing, and no known way to build libraries on this platform"
98         exit 1
99 endif
100 endif
101
102 # Automatically generate the C code from a Perl script 'generator.pl'.
103 libvirt_c.c: generator.pl
104         $(PERL) -w $<
105
106 # Extra dependencies.
107 libvirt_c.c: libvirt_c_prologue.c
108 libvirt_c.c: libvirt_c_oneoffs.c
109 libvirt_c.c: libvirt_c_epilogue.c
110
111 # Status of automatically generated bindings.
112 autostatus: libvirt_c.c
113         @echo -n "Functions which have manual bindings:    "
114         @grep ^ocaml_libvirt_ libvirt_c_oneoffs.c  | wc -l
115         @echo -n "Functions which have automatic bindings: "
116         @grep ^ocaml_libvirt_ libvirt_c.c  | wc -l
117         @echo -n "LOC in manual bindings:    "
118         @wc -l < libvirt_c_oneoffs.c
119         @echo -n "LOC in automatic bindings: "
120         @wc -l < libvirt_c.c
121
122 libvirt.cmo: libvirt.cmi
123 libvirt.cmi: libvirt.mli
124
125 libvirt_version.cmo: libvirt_version.cmi
126 libvirt_version.cmi: libvirt_version.mli
127
128
129 install-byte:
130         ocamlfind install $(OCAMLFIND_INSTFLAGS) -ldconf ignore libvirt \
131           ../META *.so *.a *.cma *.cmi *.mli
132
133 install-opt:
134         ocamlfind install $(OCAMLFIND_INSTFLAGS) -ldconf ignore libvirt \
135           ../META *.so *.a *.cma *.cmx *.cmxa *.cmi *.mli
136
137 include ../Make.rules