X-Git-Url: http://git.annexia.org/?p=virt-top.git;a=blobdiff_plain;f=libvirt%2FMakefile.in;h=53b25b012d02072eec49e7847de056017725e81b;hp=ccc7eb6ec1380bd986771d3f3b8809905b281048;hb=40cca545e1e010e8ee1a4ed4e9636b7c0119d5a2;hpb=0e09861c06a0c274bcfdacceaee347f8aaa969cb diff --git a/libvirt/Makefile.in b/libvirt/Makefile.in index ccc7eb6..53b25b0 100644 --- a/libvirt/Makefile.in +++ b/libvirt/Makefile.in @@ -1,34 +1,102 @@ -CFLAGS := @CFLAGS@ \ +# ocaml-libvirt +# Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +WIN32 = @WIN32@ + +CFLAGS = @CFLAGS@ \ -I.. \ - -I$(shell ocamlc -where) \ - -Wall -Werror \ - -fPIC \ - -g -LDFLAGS := @LDFLAGS@ + -I"$(shell ocamlc -where)" \ + @DEBUG@ @WARNINGS@ @CFLAGS_FPIC@ +LDFLAGS = @LDFLAGS@ +# -L"$(shell ocamlc -where)" -OCAMLCPACKAGES := -package extlib,unix +OCAMLC = @OCAMLC@ +OCAMLOPT = @OCAMLOPT@ +OCAMLFIND = @OCAMLFIND@ +OCAMLMKLIB = @OCAMLMKLIB@ + +ifneq ($(OCAMLFIND),) +OCAMLCPACKAGES := -package unix OCAMLCFLAGS := -g OCAMLCLIBS := -linkpkg +else +OCAMLCINCS := +OCAMLCFLAGS := -g +OCAMLCLIBS := unix.cma +endif -OCAMLOPTPACKAGES := $(OCAMLCPACKAGES) OCAMLOPTFLAGS := +ifneq ($(OCAMLFIND),) +OCAMLOPTPACKAGES := $(OCAMLCPACKAGES) OCAMLOPTLIBS := $(OCAMLCLIBS) +else +OCAMLOPTINCS := $(OCAMLCINCS) +OCAMLOPTLIBS := unix.cmxa +endif export LIBRARY_PATH=. export LD_LIBRARY_PATH=. -BYTE_TARGETS := libvirt.cma -OPT_TARGETS := libvirt.cmxa +BYTE_TARGETS := mllibvirt.cma +OPT_TARGETS := mllibvirt.cmxa all: $(BYTE_TARGETS) opt: $(OPT_TARGETS) -libvirt.cma: libvirt_c.o libvirt.cmo libvirt_version.cmo - ocamlmklib -o mllibvirt $^ $(LDFLAGS) -lvirt +COBJS := libvirt.cmo libvirt_version.cmo +OPTOBJS := libvirt.cmx libvirt_version.cmx + +ifneq ($(OCAMLMKLIB),) +# Good, we can just use ocamlmklib +mllibvirt.cma: libvirt_c.o $(COBJS) + $(OCAMLMKLIB) -o mllibvirt $^ $(LDFLAGS) -lvirt + +mllibvirt.cmxa: libvirt_c.o $(OPTOBJS) + $(OCAMLMKLIB) -o mllibvirt $^ $(LDFLAGS) -lvirt + +else +ifeq ($(WIN32),yes) +# Ugh, MinGW doesn't have ocamlmklib. This technique is copied from the +# example in OCaml distribution, otherlibs/win32unix/Makefile.nt + +mllibvirt.cma: dllmllibvirt.dll libmllibvirt.a $(COBJS) + $(OCAMLC) -a -linkall -o $@ $(COBJS) \ + -dllib -lmllibvirt -cclib -lmllibvirt -cclib "$(LDFLAGS) -lvirt" + +mllibvirt.cmxa: libmllibvirt.a $(OPTOBJS) + $(OCAMLOPT) -a -linkall -o $@ $(OPTOBJS) \ + -cclib -lmllibvirt -cclib "$(LDFLAGS) -lvirt" + +dllmllibvirt.dll: libvirt_c.o + $(CC) -shared -o $@ $^ \ + $(LDFLAGS) "$(shell ocamlc -where)"/ocamlrun.a -lvirt + +libmllibvirt.a: libvirt_c.o + ar rc $@ $^ + ranlib $@ -libvirt.cmxa: libvirt_c.o libvirt.cmx libvirt_version.cmx - ocamlmklib -o mllibvirt $^ $(LDFLAGS) -lvirt +else +# Don't know how to build a library on this platform. +$(BYTE_TARGETS) $(OPT_TARGETS): + echo "Error: ocamlmklib missing, and no known way to build libraries on this platform" + exit 1 +endif +endif libvirt.cmo: libvirt.cmi libvirt.cmi: libvirt.mli