diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-01-18 12:30:36 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-01-18 17:21:04 +0000 |
commit | 8b9eaec993e3199ff4ef1056abe2f18cbed1289b (patch) | |
tree | a720fb26bea3e1dacb70a3fc2767e92b3a28dc06 /ocaml/Makefile.am | |
parent | 607784df926aeb9293dbeb346f45d93907c7ffa2 (diff) | |
download | libguestfs-8b9eaec993e3199ff4ef1056abe2f18cbed1289b.tar.gz libguestfs-8b9eaec993e3199ff4ef1056abe2f18cbed1289b.tar.xz libguestfs-8b9eaec993e3199ff4ef1056abe2f18cbed1289b.zip |
ocaml: Use automake to build the C part of the bindings.
By arranging the C part of the bindings into a library, we can get
automake to build it instead of using $(CC) directly.
Diffstat (limited to 'ocaml/Makefile.am')
-rw-r--r-- | ocaml/Makefile.am | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am index 83c0ed4b..35cba466 100644 --- a/ocaml/Makefile.am +++ b/ocaml/Makefile.am @@ -35,10 +35,6 @@ EXTRA_DIST = \ CLEANFILES = *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/*.o t/*.a t/*.so -AM_CPPFLAGS = -I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \ - -I$(top_srcdir)/src -I$(top_builddir)/src \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) - if HAVE_OCAML OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX @@ -46,20 +42,27 @@ OCAMLOPTFLAGS = $(OCAMLCFLAGS) noinst_DATA = mlguestfs.cma mlguestfs.cmxa META -OBJS = guestfs_c.o guestfs_c_actions.o guestfs.cmo -XOBJS = $(OBJS:.cmo=.cmx) - -mlguestfs.cma: $(OBJS) - $(OCAMLMKLIB) -o mlguestfs $^ -L$(top_builddir)/src/.libs -lguestfs - -mlguestfs.cmxa: $(XOBJS) - $(OCAMLMKLIB) -o mlguestfs $^ -L$(top_builddir)/src/.libs -lguestfs - -guestfs_c.o: guestfs_c.c - $(CC) $(AM_CPPFLAGS) $(CFLAGS) -fPIC -Wall -c $< - -guestfs_c_actions.o: guestfs_c_actions.c - $(CC) $(AM_CPPFLAGS) $(CFLAGS) -fPIC -Wall -c $(srcdir)/$< +# Build the C part into a library, so that automake handles the C +# compilation step for us. Note that we don't directly use this +# library; we link with the object files that it generates. +noinst_LIBRARIES = libguestfsocaml.a + +mlguestfs.cma: libguestfsocaml.a guestfs.cmo + $(OCAMLMKLIB) -o mlguestfs \ + $(am_libguestfsocaml_a_OBJECTS) guestfs.cmo \ + -L$(top_builddir)/src/.libs -lguestfs + +mlguestfs.cmxa: libguestfsocaml.a guestfs.cmx + $(OCAMLMKLIB) -o mlguestfs \ + $(am_libguestfsocaml_a_OBJECTS) guestfs.cmx \ + -L$(top_builddir)/src/.libs -lguestfs + +libguestfsocaml_a_CFLAGS = \ + -I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \ + -I$(top_srcdir)/src -I$(top_builddir)/src \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ + -fPIC +libguestfsocaml_a_SOURCES = guestfs_c.c guestfs_c_actions.c if HAVE_OCAMLDOC |