[Libguestfs] [PATCH 1/2] build: Fix dependencies on mllib and customize.

Richard W.M. Jones rjones at redhat.com
Mon Jul 18 10:29:16 UTC 2016


Binaries should be rebuilt if mllib.cma/mllib.cmxa or
customize.cma/customize.cmxa change.

Fixes commit 1e2877c6f4d1d254026d38b1cac4895d8dba7d5d.
---
 builder/Makefile.am    | 12 ++++++++++--
 customize/Makefile.am  |  3 ++-
 dib/Makefile.am        |  5 ++++-
 get-kernel/Makefile.am |  5 ++++-
 mllib/Makefile.am      | 15 ++++++++++++---
 resize/Makefile.am     |  5 ++++-
 sparsify/Makefile.am   |  6 ++++--
 subdir-rules.mk        |  6 ++++++
 sysprep/Makefile.am    |  6 +++++-
 v2v/Makefile.am        |  9 +++++++--
 10 files changed, 58 insertions(+), 14 deletions(-)

diff --git a/builder/Makefile.am b/builder/Makefile.am
index 4e77f52..b2d5ad3 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -167,7 +167,11 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa customize.cmxa
 endif
 
-virt_builder_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
+virt_builder_DEPENDENCIES = \
+	$(OBJECTS) \
+	../mllib/mllib.$(MLARCHIVE) \
+	../customize/customize.$(MLARCHIVE) \
+	$(top_srcdir)/ocaml-link.sh
 virt_builder_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
@@ -236,7 +240,11 @@ yajl_tests_THEOBJECTS = $(yajl_tests_BOBJECTS)
 yajl_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
 endif
 
-yajl_tests_DEPENDENCIES = $(yajl_tests_THEOBJECTS) $(top_srcdir)/ocaml-link.sh
+yajl_tests_DEPENDENCIES = \
+	$(yajl_tests_THEOBJECTS) \
+	../mllib/mllib.$(MLARCHIVE) \
+	../customize/customize.$(MLARCHIVE) \
+	$(top_srcdir)/ocaml-link.sh
 yajl_tests_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) $(OCAMLLINKFLAGS) \
diff --git a/customize/Makefile.am b/customize/Makefile.am
index 4befc75..dd35cdc 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -165,7 +165,8 @@ OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 virt_customize_DEPENDENCIES = \
 	$(top_srcdir)/ocaml-link.sh \
 	$(CUSTOMIZE_THEOBJECTS) \
-	$(CUSTOMIZE_CMA)
+	$(CUSTOMIZE_CMA) \
+	../mllib/mllib.$(MLARCHIVE)
 virt_customize_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
diff --git a/dib/Makefile.am b/dib/Makefile.am
index 4cf052f..a57d89d 100644
--- a/dib/Makefile.am
+++ b/dib/Makefile.am
@@ -89,7 +89,10 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa
 endif
 
-virt_dib_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
+virt_dib_DEPENDENCIES = \
+	$(OBJECTS) \
+	../mllib/mllib.$(MLARCHIVE) \
+	$(top_srcdir)/ocaml-link.sh
 virt_dib_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
diff --git a/get-kernel/Makefile.am b/get-kernel/Makefile.am
index 2ad3ad0..e145972 100644
--- a/get-kernel/Makefile.am
+++ b/get-kernel/Makefile.am
@@ -86,7 +86,10 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa
 endif
 
-virt_get_kernel_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
+virt_get_kernel_DEPENDENCIES = \
+	$(OBJECTS) \
+	../mllib/mllib.$(MLARCHIVE) \
+	$(top_srcdir)/ocaml-link.sh
 virt_get_kernel_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index dc36f26..8a02c1f 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -202,21 +202,30 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa
 endif
 
-common_utils_tests_DEPENDENCIES = $(common_utils_tests_THEOBJECTS) $(top_srcdir)/ocaml-link.sh
+common_utils_tests_DEPENDENCIES = \
+	$(common_utils_tests_THEOBJECTS) \
+	$(MLLIB_CMA) \
+	$(top_srcdir)/ocaml-link.sh
 common_utils_tests_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '-lutils $(LIBXML2_LIBS) -lgnu' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
 	  $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
 	  $(common_utils_tests_THEOBJECTS) -o $@
 
-getopt_tests_DEPENDENCIES = $(getopt_tests_THEOBJECTS) $(top_srcdir)/ocaml-link.sh
+getopt_tests_DEPENDENCIES = \
+	$(getopt_tests_THEOBJECTS) \
+	$(MLLIB_CMA) \
+	$(top_srcdir)/ocaml-link.sh
 getopt_tests_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '-lutils $(LIBXML2_LIBS) -lgnu' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
 	  $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
 	  $(getopt_tests_THEOBJECTS) -o $@
 
-JSON_tests_DEPENDENCIES = $(JSON_tests_THEOBJECTS) $(top_srcdir)/ocaml-link.sh
+JSON_tests_DEPENDENCIES = \
+	$(JSON_tests_THEOBJECTS) \
+	$(MLLIB_CMA) \
+	$(top_srcdir)/ocaml-link.sh
 JSON_tests_LINK = \
 	$(top_srcdir)/ocaml-link.sh -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
diff --git a/resize/Makefile.am b/resize/Makefile.am
index 20d264b..96604b6 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -83,7 +83,10 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa
 endif
 
-virt_resize_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
+virt_resize_DEPENDENCIES = \
+	$(OBJECTS) \
+	../mllib/mllib.$(MLARCHIVE) \
+	$(top_srcdir)/ocaml-link.sh
 virt_resize_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index 5c03394..847825a 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
@@ -87,8 +87,10 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa
 endif
 
-virt_sparsify_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
-
+virt_sparsify_DEPENDENCIES = \
+	$(OBJECTS) \
+	../mllib/mllib.$(MLARCHIVE) \
+	$(top_srcdir)/ocaml-link.sh
 virt_sparsify_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
diff --git a/subdir-rules.mk b/subdir-rules.mk
index dd59349..525d210 100644
--- a/subdir-rules.mk
+++ b/subdir-rules.mk
@@ -47,6 +47,12 @@ LOG_DRIVER = env $(SHELL) $(top_srcdir)/build-aux/guestfs-test-driver
 # See also:
 # guestfs-hacking(1) section "HOW OCAML PROGRAMS ARE COMPILED AND LINKED"
 
+if !HAVE_OCAMLOPT
+MLARCHIVE = cma
+else
+MLARCHIVE = cmxa
+endif
+
 .mli.cmi:
 	$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
 .ml.cmo:
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 25193b2..1504df2 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -135,7 +135,11 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa customize.cmxa
 endif
 
-virt_sysprep_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
+virt_sysprep_DEPENDENCIES = \
+	$(OBJECTS) \
+	../mllib/mllib.$(MLARCHIVE) \
+	../customize/customize.$(MLARCHIVE) \
+	$(top_srcdir)/ocaml-link.sh
 virt_sysprep_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index d5d4c04..988cba5 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -189,7 +189,9 @@ COPY_TO_LOCAL_OBJECTS = $(COPY_TO_LOCAL_XOBJECTS)
 endif
 
 virt_v2v_copy_to_local_DEPENDENCIES = \
-	$(COPY_TO_LOCAL_OBJECTS) $(top_srcdir)/ocaml-link.sh
+	$(COPY_TO_LOCAL_OBJECTS) \
+	../mllib/mllib.$(MLARCHIVE) \
+	$(top_srcdir)/ocaml-link.sh
 virt_v2v_copy_to_local_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
@@ -405,7 +407,10 @@ v2v_unit_tests_THEOBJECTS = $(v2v_unit_tests_XOBJECTS)
 v2v_unit_tests.cmx: OCAMLPACKAGES += -package oUnit
 endif
 
-v2v_unit_tests_DEPENDENCIES = $(v2v_unit_tests_THEOBJECTS) $(top_srcdir)/ocaml-link.sh
+v2v_unit_tests_DEPENDENCIES = \
+	$(v2v_unit_tests_THEOBJECTS) \
+	../mllib/mllib.$(MLARCHIVE) \
+	$(top_srcdir)/ocaml-link.sh
 v2v_unit_tests_LINK = \
 	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) \
-- 
2.7.4




More information about the Libguestfs mailing list