mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
- Add $(srcdir), $(builddir) to Makefiles where required - Post-process ocamldep output - generate ocaml/.depends
103 lines
2.6 KiB
Makefile
103 lines
2.6 KiB
Makefile
# libguestfs OCaml tools common code
|
|
# Copyright (C) 2011-2018 Red Hat Inc.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program 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 General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
include $(top_srcdir)/subdir-rules.mk
|
|
|
|
EXTRA_DIST = \
|
|
$(SOURCES_MLI) \
|
|
$(SOURCES_ML) \
|
|
$(SOURCES_C)
|
|
|
|
SOURCES_MLI = \
|
|
progress.mli
|
|
|
|
SOURCES_ML = \
|
|
progress.ml
|
|
|
|
SOURCES_C = \
|
|
progress-c.c
|
|
|
|
if HAVE_OCAML
|
|
|
|
# We pretend that we're building a C library. automake handles the
|
|
# compilation of the C sources for us. At the end we take the C
|
|
# objects and OCaml objects and link them into the OCaml library.
|
|
# This C library is never used.
|
|
|
|
noinst_LIBRARIES = libmlprogress.a
|
|
|
|
if !HAVE_OCAMLOPT
|
|
MLPROGRESS_CMA = mlprogress.cma
|
|
else
|
|
MLPROGRESS_CMA = mlprogress.cmxa
|
|
endif
|
|
|
|
noinst_DATA = $(MLPROGRESS_CMA)
|
|
|
|
libmlprogress_a_SOURCES = $(SOURCES_C)
|
|
libmlprogress_a_CPPFLAGS = \
|
|
-I. \
|
|
-I$(top_builddir) \
|
|
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
|
|
-I$(shell $(OCAMLC) -where) \
|
|
-I$(top_srcdir)/common/utils \
|
|
-I$(top_srcdir)/lib \
|
|
-I$(top_srcdir)/common/progress
|
|
libmlprogress_a_CFLAGS = \
|
|
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
|
|
$(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \
|
|
-fPIC
|
|
|
|
BOBJECTS = $(SOURCES_ML:.ml=.cmo)
|
|
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
|
|
|
|
# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
|
|
# option to be passed to gcc, so we don't try linking against an
|
|
# installed copy of libguestfs.
|
|
OCAMLPACKAGES = \
|
|
-package str,unix \
|
|
-I $(top_builddir)/common/utils/.libs \
|
|
-I $(top_builddir)/lib/.libs \
|
|
-I $(top_builddir)/gnulib/lib/.libs \
|
|
-I $(top_builddir)/ocaml \
|
|
-I $(builddir)
|
|
|
|
OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
|
|
|
|
if !HAVE_OCAMLOPT
|
|
OBJECTS = $(BOBJECTS)
|
|
else
|
|
OBJECTS = $(XOBJECTS)
|
|
endif
|
|
|
|
libmlprogress_a_DEPENDENCIES = $(OBJECTS)
|
|
|
|
$(MLPROGRESS_CMA): $(OBJECTS) libmlprogress.a
|
|
$(OCAMLFIND) mklib $(OCAMLPACKAGES) \
|
|
$(OBJECTS) $(libmlprogress_a_OBJECTS) \
|
|
-cclib -lprogress \
|
|
-o mlprogress
|
|
|
|
# OCaml dependencies.
|
|
.depend: $(srcdir)/*.mli $(srcdir)/*.ml
|
|
$(top_builddir)/ocaml-dep.sh $^
|
|
-include .depend
|
|
|
|
endif
|
|
|
|
.PHONY: docs
|