1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
# libguestfs OCaml tools common code
# Copyright (C) 2011-2019 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) \
$(filter-out $(CONFIGURE_GENERATED_ML),$(SOURCES_ML)) \
std_utils_tests.ml
CONFIGURE_GENERATED_ML = \
guestfs_config.ml
SOURCES_MLI = \
guestfs_config.mli \
std_utils.mli \
stringMap.mli \
stringSet.mli
SOURCES_ML = \
$(CONFIGURE_GENERATED_ML) \
stringMap.ml \
stringSet.ml \
std_utils.ml
# 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 = libmlstdutils.a
if !HAVE_OCAMLOPT
MLSTDUTILS_CMA = mlstdutils.cma
else
MLSTDUTILS_CMA = mlstdutils.cmxa
endif
# Just for this library, we need to build both bytecode and native
# code because the generator always requires the bytecode version.
noinst_DATA = mlstdutils.cma
if HAVE_OCAMLOPT
noinst_DATA += mlstdutils.cmxa
endif
libmlstdutils_a_SOURCES = dummy.c
libmlstdutils_a_CPPFLAGS = \
-I. \
-I$(top_builddir)
libmlstdutils_a_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-fPIC
BOBJECTS = $(SOURCES_ML:.ml=.cmo)
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
OCAMLPACKAGES = \
-package str,unix \
-I $(builddir)
OCAMLPACKAGES_TESTS = $(MLSTDUTILS_CMA)
if HAVE_OCAML_PKG_OUNIT
OCAMLPACKAGES_TESTS += -package ounit2
endif
OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) -ccopt '$(CFLAGS)'
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
else
OBJECTS = $(XOBJECTS)
endif
libmlstdutils_a_DEPENDENCIES = $(OBJECTS)
mlstdutils.cma: $(BOBJECTS)
$(OCAMLFIND) ocamlc $(OCAMLPACKAGES) -a $^ -o $@
if HAVE_OCAMLOPT
mlstdutils.cmxa: $(XOBJECTS)
$(OCAMLFIND) ocamlopt $(OCAMLPACKAGES) -a $^ -o $@
endif
# Tests.
std_utils_tests_SOURCES = dummy.c
std_utils_tests_CPPFLAGS = \
-I. \
-I$(top_builddir)
std_utils_tests_BOBJECTS = std_utils_tests.cmo
std_utils_tests_XOBJECTS = $(std_utils_tests_BOBJECTS:.cmo=.cmx)
# Can't call the following as <test>_OBJECTS because automake gets confused.
if !HAVE_OCAMLOPT
std_utils_tests_THEOBJECTS = $(std_utils_tests_BOBJECTS)
std_utils_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
else
std_utils_tests_THEOBJECTS = $(std_utils_tests_XOBJECTS)
std_utils_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
endif
OCAMLLINKFLAGS = $(LINK_CUSTOM_OCAMLC_ONLY)
std_utils_tests_DEPENDENCIES = \
$(std_utils_tests_THEOBJECTS) \
$(MLSTDUTILS_CMA) \
$(top_srcdir)/ocaml-link.sh
std_utils_tests_LINK = \
$(top_srcdir)/ocaml-link.sh -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
$(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
$(std_utils_tests_THEOBJECTS) -o $@
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS =
check_PROGRAMS =
if HAVE_OCAML_PKG_OUNIT
check_PROGRAMS += std_utils_tests
TESTS += std_utils_tests
endif
check-valgrind:
$(MAKE) VG="@VG@" check
# OCaml dependencies.
.depend: $(srcdir)/*.mli $(srcdir)/*.ml
$(top_builddir)/ocaml-dep.sh $^
-include .depend
.PHONY: docs
|