Re: [Libguestfs] [PATCH] build: Add a common script for generating OCaml dependencies correctly.

2017-08-09 Thread Richard W.M. Jones
On Wed, Aug 09, 2017 at 03:40:54PM +0200, Pino Toscano wrote:
> BTW, unrelated to this patch, just because I'm noticing them: what are
> all the "docs" dependencies in .PHONY?  At least for newer Makefile's
> I guess they were just copied from existing ones, but I did not find
> any reference/reason for the ones in older tools.  Do you remember more
> about them?

I'm guessing they are left over from something and no longer
used/useful.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] build: Add a common script for generating OCaml dependencies correctly.

2017-08-09 Thread Pino Toscano
On Tuesday, 8 August 2017 16:34:49 CEST Richard W.M. Jones wrote:
> These are generated in many different ways in the various
> subdirectories, and sometimes not generated correctly.  Introduce a
> script to do this in one place, and hopefully correctly.
> 
> This is mostly simple refactoring, but I got rid of a couple of
> things:
> 
> (1) The ‘make depend’ rule doesn't appear to be needed.  automake (or
> make?)  seems to rebuild the ‘.depend’ file automatically just because
> it is included.
> 
> (2) I got rid of the hairy path rewriting sed expression.  Possibly
> that is needed for srcdir != builddir.
> ---

Mostly LGTM, just one note:

> +echo "  OCAMLDEP $output"

I'd remove this, since it the makefile will output the ocaml-dep.sh
invocation anyway -- a better solution should be done by taking the
silent build configuration into account.

BTW, unrelated to this patch, just because I'm noticing them: what are
all the "docs" dependencies in .PHONY?  At least for newer Makefile's
I guess they were just copied from existing ones, but I did not find
any reference/reason for the ones in older tools.  Do you remember more
about them?

-- 
Pino Toscano

signature.asc
Description: This is a digitally signed message part.
___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

[Libguestfs] [PATCH] build: Add a common script for generating OCaml dependencies correctly.

2017-08-08 Thread Richard W.M. Jones
These are generated in many different ways in the various
subdirectories, and sometimes not generated correctly.  Introduce a
script to do this in one place, and hopefully correctly.

This is mostly simple refactoring, but I got rid of a couple of
things:

(1) The ‘make depend’ rule doesn't appear to be needed.  automake (or
make?)  seems to rebuild the ‘.depend’ file automatically just because
it is included.

(2) I got rid of the hairy path rewriting sed expression.  Possibly
that is needed for srcdir != builddir.
---
 .gitignore|  1 +
 builder/Makefile.am   | 17 +++-
 common/mlpcre/Makefile.am | 15 ++
 common/mlprogress/Makefile.am | 17 +++-
 common/mlstdutils/Makefile.am | 17 +++-
 common/mlutils/Makefile.am| 15 ++
 common/mlvisit/Makefile.am| 17 +++-
 common/mlxml/Makefile.am  | 15 ++
 configure.ac  |  2 ++
 customize/Makefile.am | 17 +++-
 daemon/Makefile.am| 15 ++
 dib/Makefile.am   | 17 +++-
 generator/Makefile.am | 15 ++
 get-kernel/Makefile.am| 17 ++--
 mllib/Makefile.am | 15 ++
 ocaml-dep.sh.in   | 64 +++
 ocaml/Makefile.am | 13 ++---
 resize/Makefile.am| 15 ++
 sparsify/Makefile.am  | 17 +++-
 sysprep/Makefile.am   | 17 +++-
 v2v/Makefile.am   | 15 ++
 v2v/test-harness/Makefile.am  | 15 ++
 22 files changed, 131 insertions(+), 237 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0e7a649f8..4d738d10f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -380,6 +380,7 @@ Makefile.in
 /mllib/getopt_tests
 /mllib/JSON_tests
 /mllib/oUnit-*
+/ocaml-dep.sh
 /ocaml/bindtests.bc
 /ocaml/bindtests.opt
 /ocaml/bindtests.ml
diff --git a/builder/Makefile.am b/builder/Makefile.am
index 1b51376be..e1c7bd016 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -310,23 +310,14 @@ CLEANFILES += \
console-*.img \
console-*.out
 
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
-   rm -f $@ $@-t
-   $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I 
$(abs_top_builddir)/common/mlstdutils -I $(abs_top_builddir)/common/mlutils -I 
$(abs_top_builddir)/common/mlpcre -I $(abs_top_builddir)/mllib -I 
$(abs_top_builddir)/customize $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
-   mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+   $(top_builddir)/ocaml-dep.sh $^
 -include .depend
 
 endif
 
-.PHONY: depend docs
+.PHONY: docs
 
 # virt-builder's default repository
 
diff --git a/common/mlpcre/Makefile.am b/common/mlpcre/Makefile.am
index aa638cd94..fd4027a1f 100644
--- a/common/mlpcre/Makefile.am
+++ b/common/mlpcre/Makefile.am
@@ -124,19 +124,10 @@ check-valgrind:
$(MAKE) VG="@VG@" check
 
 # Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
-   rm -f $@ $@-t
-   $(OCAMLFIND) ocamldep -I ../../ocaml -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
-   mv $@-t $@
-
+.depend: *.mli *.ml
+   $(top_builddir)/ocaml-dep.sh $^
 -include .depend
 
 endif
 
-.PHONY: depend docs
+.PHONY: docs
diff --git a/common/mlprogress/Makefile.am b/common/mlprogress/Makefile.am
index d4a229451..189aa5453 100644
--- a/common/mlprogress/Makefile.am
+++ b/common/mlprogress/Makefile.am
@@ -92,20 +92,11 @@ $(MLPROGRESS_CMA): $(OBJECTS) libmlprogress.a
-cclib -lprogress \
-o mlprogress
 
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
-   rm -f $@ $@-t
-   $(OCAMLFIND) ocamldep -I ../../ocaml -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
-   mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+   $(top_builddir)/ocaml-dep.sh $^
 -include .depend
 
 endif
 
-.PHONY: depend docs
+.PHONY: docs
diff --git a/common/mlstdutils/Makefile.am b/common/mlstdutils/Makefile.am
index ccf7c6884..5208e491f 100644
--- a/common/mlstdutils/Makefile.am
+++ b/common/mlstdutils/Makefile.am
@@ -147,18 +147,9 @@ endif
 check-valgrind:
$(MAKE) VG="@VG@" check
 
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
-   rm -f $@ $@-t
-   $(OCAMLFIND) ocamldep -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
-