Richard W.M. Jones
2016-Jul-18 10:29 UTC
[Libguestfs] [PATCH 1/2] build: Fix dependencies on mllib and customize.
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
Richard W.M. Jones
2016-Jul-18 10:29 UTC
[Libguestfs] [PATCH 2/2] build: Factor out definition of BEST and OCAMLLINKFLAGS.
No change, just refactoring. --- builder/Makefile.am | 6 ++---- customize/Makefile.am | 6 ++---- dib/Makefile.am | 6 ++---- get-kernel/Makefile.am | 6 ++---- mllib/Makefile.am | 8 ++------ resize/Makefile.am | 6 ++---- sparsify/Makefile.am | 6 ++---- subdir-rules.mk | 3 +++ sysprep/Makefile.am | 6 ++---- v2v/Makefile.am | 6 ++---- 10 files changed, 21 insertions(+), 38 deletions(-) diff --git a/builder/Makefile.am b/builder/Makefile.am index b2d5ad3..2581c5a 100644 --- a/builder/Makefile.am +++ b/builder/Makefile.am @@ -159,14 +159,12 @@ OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) if !HAVE_OCAMLOPT OBJECTS = $(BOBJECTS) -BEST = c -OCAMLLINKFLAGS = mlguestfs.cma mllib.cma customize.cma -custom else OBJECTS = $(XOBJECTS) -BEST = opt -OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa customize.cmxa endif +OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) mllib.$(MLARCHIVE) customize.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) + virt_builder_DEPENDENCIES = \ $(OBJECTS) \ ../mllib/mllib.$(MLARCHIVE) \ diff --git a/customize/Makefile.am b/customize/Makefile.am index dd35cdc..d992b54 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -143,14 +143,12 @@ CUSTOMIZE_XOBJECTS = $(BOBJECTS:.cmo=.cmx) if !HAVE_OCAMLOPT CUSTOMIZE_THEOBJECTS = $(CUSTOMIZE_BOBJECTS) -BEST = c -OCAMLLINKFLAGS = mlguestfs.cma mllib.cma customize.cma -custom else CUSTOMIZE_THEOBJECTS = $(CUSTOMIZE_XOBJECTS) -BEST = opt -OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa customize.cmxa endif +OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) mllib.$(MLARCHIVE) customize.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) + OCAMLCLIBS = \ -lutils \ $(LIBTINFO_LIBS) \ diff --git a/dib/Makefile.am b/dib/Makefile.am index a57d89d..9b986cc 100644 --- a/dib/Makefile.am +++ b/dib/Makefile.am @@ -81,14 +81,12 @@ OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) if !HAVE_OCAMLOPT OBJECTS = $(BOBJECTS) -BEST = c -OCAMLLINKFLAGS = mlguestfs.cma mllib.cma -custom else OBJECTS = $(XOBJECTS) -BEST = opt -OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa endif +OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) mllib.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) + virt_dib_DEPENDENCIES = \ $(OBJECTS) \ ../mllib/mllib.$(MLARCHIVE) \ diff --git a/get-kernel/Makefile.am b/get-kernel/Makefile.am index e145972..7cefdd6 100644 --- a/get-kernel/Makefile.am +++ b/get-kernel/Makefile.am @@ -78,14 +78,12 @@ OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) if !HAVE_OCAMLOPT OBJECTS = $(BOBJECTS) -BEST = c -OCAMLLINKFLAGS = mlguestfs.cma mllib.cma -custom else OBJECTS = $(XOBJECTS) -BEST = opt -OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa endif +OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) mllib.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) + virt_get_kernel_DEPENDENCIES = \ $(OBJECTS) \ ../mllib/mllib.$(MLARCHIVE) \ diff --git a/mllib/Makefile.am b/mllib/Makefile.am index 8a02c1f..0433b4c 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -185,9 +185,6 @@ getopt_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) JSON_tests_THEOBJECTS = $(JSON_tests_BOBJECTS) JSON_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) - -BEST = c -OCAMLLINKFLAGS = mlguestfs.cma -custom else common_utils_tests_THEOBJECTS = $(common_utils_tests_XOBJECTS) common_utils_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) @@ -197,11 +194,10 @@ getopt_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) JSON_tests_THEOBJECTS = $(JSON_tests_XOBJECTS) JSON_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) - -BEST = opt -OCAMLLINKFLAGS = mlguestfs.cmxa endif +OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) + common_utils_tests_DEPENDENCIES = \ $(common_utils_tests_THEOBJECTS) \ $(MLLIB_CMA) \ diff --git a/resize/Makefile.am b/resize/Makefile.am index 96604b6..cf2f9cf 100644 --- a/resize/Makefile.am +++ b/resize/Makefile.am @@ -75,14 +75,12 @@ OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) if !HAVE_OCAMLOPT OBJECTS = $(BOBJECTS) -BEST = c -OCAMLLINKFLAGS = mlguestfs.cma mllib.cma -custom else OBJECTS = $(XOBJECTS) -BEST = opt -OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa endif +OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) mllib.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) + virt_resize_DEPENDENCIES = \ $(OBJECTS) \ ../mllib/mllib.$(MLARCHIVE) \ diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am index 847825a..5293fbf 100644 --- a/sparsify/Makefile.am +++ b/sparsify/Makefile.am @@ -79,14 +79,12 @@ OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) if !HAVE_OCAMLOPT OBJECTS = $(BOBJECTS) -BEST = c -OCAMLLINKFLAGS = mlguestfs.cma mllib.cma -custom else OBJECTS = $(XOBJECTS) -BEST = opt -OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa endif +OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) mllib.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) + virt_sparsify_DEPENDENCIES = \ $(OBJECTS) \ ../mllib/mllib.$(MLARCHIVE) \ diff --git a/subdir-rules.mk b/subdir-rules.mk index 525d210..39c2f50 100644 --- a/subdir-rules.mk +++ b/subdir-rules.mk @@ -49,8 +49,11 @@ LOG_DRIVER = env $(SHELL) $(top_srcdir)/build-aux/guestfs-test-driver if !HAVE_OCAMLOPT MLARCHIVE = cma +LINK_CUSTOM_OCAMLC_ONLY = -custom +BEST = c else MLARCHIVE = cmxa +BEST = opt endif .mli.cmi: diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index 1504df2..66e2ceb 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -127,14 +127,12 @@ OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) if !HAVE_OCAMLOPT OBJECTS = $(BOBJECTS) -BEST = c -OCAMLLINKFLAGS = mlguestfs.cma mllib.cma customize.cma -custom else OBJECTS = $(XOBJECTS) -BEST = opt -OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa customize.cmxa endif +OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) mllib.$(MLARCHIVE) customize.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) + virt_sysprep_DEPENDENCIES = \ $(OBJECTS) \ ../mllib/mllib.$(MLARCHIVE) \ diff --git a/v2v/Makefile.am b/v2v/Makefile.am index 988cba5..6529f13 100644 --- a/v2v/Makefile.am +++ b/v2v/Makefile.am @@ -146,14 +146,12 @@ OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) if !HAVE_OCAMLOPT OBJECTS = $(BOBJECTS) -BEST = c -OCAMLLINKFLAGS = mlguestfs.cma mllib.cma -custom else OBJECTS = $(XOBJECTS) -BEST = opt -OCAMLLINKFLAGS = mlguestfs.cmxa mllib.cmxa endif +OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) mllib.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) + virt_v2v_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh virt_v2v_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ -- 2.7.4
Pino Toscano
2016-Jul-18 12:48 UTC
Re: [Libguestfs] [PATCH 1/2] build: Fix dependencies on mllib and customize.
On Monday, 18 July 2016 11:29:16 CEST Richard W.M. Jones wrote:> Binaries should be rebuilt if mllib.cma/mllib.cmxa or > customize.cma/customize.cmxa change. > > Fixes commit 1e2877c6f4d1d254026d38b1cac4895d8dba7d5d. > ---The series LGTM. Thanks, -- Pino Toscano
Seemingly Similar Threads
- [PATCH 1/2] build: factor out the OCaml link.sh scripts
- [PATCH 2/3] build: run ocaml-link.sh from build directory
- [PATCH 0/2] Build mllib and customize into libraries.
- [PATCH 0/5] Miscellaneous refactoring of common/utils, create common/mltools
- [PATCH v6 10/41] mllib, v2v: Split out OCaml utils bindings ‘common/mlutils’.