[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] Fix dependencies on generator.ml



This change adds an explicit dependency on generator.ml for every file it
generates, except java files. Java is left for another time because it's
considerably trickier.

This fixes parallel make, and will automatically re-create generated files when
make is run from any directory.

It also fixes the problem which efad4f53 was targetting. Specifically,
src/guestfs_protocol.(c|h) had an erroneous dependency on stamp-generator, and
therefore generator.ml, despite not being directly created by it. This caused
them to be recreated every time generator.ml ran rather than only when
src/guestfs_protocol.x was updated, which cascaded into a daemon and therefore
appliance update.
---
 Makefile.am           |   15 +++++++++++++--
 capitests/Makefile.am |   12 ++++++++++--
 daemon/Makefile.am    |   26 +++++++++++++++++++++-----
 fish/Makefile.am      |   24 ++++++++++++++++--------
 haskell/Makefile.am   |   15 ++++++++++++++-
 java/Makefile.am      |    8 ++++++++
 ocaml/Makefile.am     |   16 +++++++++++++---
 perl/Makefile.am      |   16 ++++++++++++----
 python/Makefile.am    |   14 +++++++++++---
 ruby/Makefile.am      |   14 +++++++++++---
 src/Makefile.am       |   33 +++++++++++++++++----------------
 11 files changed, 146 insertions(+), 47 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 87efb2d..66f2144 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,9 +54,20 @@ if HAVE_HASKELL
 SUBDIRS += haskell
 endif
 
+GENERATOR_ML = \
+	guestfs-structs.pod \
+	guestfs-actions.pod \
+	guestfish-actions.pod
+
+.PHONY: force
+
+$(GENERATOR_ML): force
+	$(MAKE) -C $(top_builddir)/src stamp-generator
+
 EXTRA_DIST = \
-	guestfs.pod guestfs-actions.pod guestfs-structs.pod \
-	guestfish.pod guestfish-actions.pod \
+	$(GENERATOR_ML) \
+	guestfs.pod \
+	guestfish.pod \
 	html/pod.css \
 	HACKING TODO \
 	libguestfs.pc libguestfs.pc.in \
diff --git a/capitests/Makefile.am b/capitests/Makefile.am
index 3b80c0e..d40d3ca 100644
--- a/capitests/Makefile.am
+++ b/capitests/Makefile.am
@@ -15,8 +15,16 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-EXTRA_DIST = \
-	tests.c
+GENERATOR_ML = tests.c
+
+.PHONY: force
+
+$(GENERATOR_ML): force
+	$(MAKE) -C $(top_builddir)/src stamp-generator
+
+BUILT_SOURCES = $(GENERATOR_ML)
+
+EXTRA_DIST = $(BUILT_SOURCES)
 
 # Tests.  These are auto-generated from the test descriptions
 # in the generator.
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index d049da6..a2e6a29 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -19,6 +19,25 @@ ACLOCAL_AMFLAGS = -I m4
 
 SUBDIRS = lib tests .
 
+libsrcdir = $(top_builddir)/../src
+
+GENERATOR_ML = \
+	actions.h \
+	stubs.c \
+	names.c
+
+.PHONY: force
+
+$(GENERATOR_ML): force
+	$(MAKE) -C $(libsrcdir) stamp-generator
+
+BUILT_SOURCES = $(GENERATOR_ML)
+
+EXTRA_DIST = $(BUILT_SOURCES)
+
+$(libsrcdir)/guestfs_protocol.o: force
+	$(MAKE) -C $(libsrcdir) guestfs_protocol.o
+
 noinst_PROGRAMS = guestfsd
 guestfsd_SOURCES = \
 	actions.h \
@@ -83,11 +102,8 @@ guestfsd_SOURCES = \
 	wc.c \
 	xattr.c \
 	zero.c \
-	zerofree.c \
-	$(top_builddir)/../src/guestfs_protocol.h \
-	$(top_builddir)/../src/guestfs_protocol.c
+	zerofree.c
+guestfsd_LDADD = $(libsrcdir)/guestfs_protocol.o lib/libgnu.a
 
 AM_CPPFLAGS = -I$(srcdir)/lib -Ilib
 guestfsd_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
-
-LDADD = lib/libgnu.a
diff --git a/fish/Makefile.am b/fish/Makefile.am
index c8ba3ea..8e3b9eb 100644
--- a/fish/Makefile.am
+++ b/fish/Makefile.am
@@ -17,15 +17,27 @@
 
 bin_PROGRAMS = guestfish
 
+GENERATOR_ML = \
+	cmds.c \
+	completion.c
+
+.PHONY: force
+
+$(GENERATOR_ML): force
+	$(MAKE) -C $(top_builddir)/src stamp-generator
+
+BUILT_SOURCES = \
+	$(GENERATOR_ML) \
+	rc_protocol.h \
+	rc_protocol.c
+
 EXTRA_DIST = \
+	$(BUILT_SOURCES) \
 	rc_protocol.x
 
-CLEANFILES = rc_protocol.c rc_protocol.h
-
 guestfish_SOURCES = \
+	$(GENERATOR_ML) \
 	alloc.c \
-	cmds.c \
-	completion.c \
 	destpaths.c \
 	echo.c \
 	edit.c \
@@ -44,10 +56,6 @@ guestfish_SOURCES = \
 librc_protocol_la_SOURCES = rc_protocol.c
 librc_protocol_la_CFLAGS = -Wall -Wno-unused
 
-BUILT_SOURCES = \
-	rc_protocol.c \
-	rc_protocol.h
-
 guestfish_CFLAGS = \
 	-I$(top_srcdir)/src -I$(top_builddir)/src \
 	-I$(top_srcdir)/fish -I$(top_builddir)/fish \
diff --git a/haskell/Makefile.am b/haskell/Makefile.am
index dcaf18a..b9acb40 100644
--- a/haskell/Makefile.am
+++ b/haskell/Makefile.am
@@ -15,7 +15,18 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-EXTRA_DIST = *.hs run-bindtests
+GENERATOR_ML = \
+	Guestfs.hs \
+	Bindtests.hs
+
+.PHONY: force
+
+$(GENERATOR_ML): force
+	$(MAKE) -C $(top_builddir)/src stamp-generator
+
+# $(GENERATOR_ML) isn't redundant below as the wildcard rule won't match, and
+# therefore won't generate, the files if they haven't been created yet
+EXTRA_DIST = $(GENERATOR_ML) *.hs run-bindtests
 
 CLEANFILES = *~
 
@@ -32,6 +43,8 @@ check_DATA = Bindtests
 
 GHCFLAGS = -I$(top_builddir)/src -L$(top_builddir)/src/.libs
 
+all: Bindtests Guestfs005Load Guestfs010Launch Guestfs050LVCreate
+
 Bindtests: Bindtests.hs Guestfs.hs
 	$(GHC)  $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
 
diff --git a/java/Makefile.am b/java/Makefile.am
index 6ddf8b4..4bda32c 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -18,6 +18,14 @@
 # Old RHEL 5 autoconf doesn't have builddir.
 builddir ?= $(top_builddir)/java
 
+# XXX: Need to fix generator.ml dependencies
+#
+# Files generated by generator.ml:
+#   Makefile.inc
+#   All files listed in Makefile.inc
+#   com_redhat_et_libguestfs_GuestFS.c
+#   Bindtests.java
+
 java_prefix = com/redhat/et/libguestfs
 
 # Pull in automatically generated built sources
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index bb7407a..4375337 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -15,12 +15,22 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+GENERATOR_ML = \
+	guestfs.mli \
+	guestfs.ml \
+	guestfs_c_actions.c \
+	bindtests.ml
+
+.PHONY: force
+
+$(GENERATOR_ML): force
+	$(MAKE) -C $(top_builddir)/src stamp-generator
+
 EXTRA_DIST = \
-	guestfs.mli guestfs.ml \
-	guestfs_c.c guestfs_c.h guestfs_c_actions.c \
+	$(GENERATOR_ML) \
+	guestfs_c.c guestfs_c.h \
 	guestfs_inspector.mli guestfs_inspector.ml \
 	.depend META.in \
-	bindtests.ml \
 	run-bindtests \
 	t/*.ml
 
diff --git a/perl/Makefile.am b/perl/Makefile.am
index 4b7ed99..afd04d1 100644
--- a/perl/Makefile.am
+++ b/perl/Makefile.am
@@ -15,17 +15,25 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+GENERATOR_ML = \
+	Guestfs.xs \
+	lib/Sys/Guestfs.pm \
+	bindtests.pl
+
+.PHONY: force
+
+$(GENERATOR_ML): force
+	$(MAKE) -C $(top_builddir)/src stamp-generator
+
 EXTRA_DIST = \
+	$(GENERATOR_ML) \
 	Makefile.PL.in \
-	Guestfs.xs \
 	examples/README \
 	examples/LICENSE \
 	examples/*.pl \
-	lib/Sys/Guestfs.pm \
 	lib/Sys/Guestfs/Lib.pm \
 	run-bindtests \
 	run-perl-tests \
-	bindtests.pl \
 	t/*.t \
 	typemap
 
@@ -42,7 +50,7 @@ TESTS_ENVIRONMENT = \
 
 INSTALLDIRS = site
 
-all: Makefile-pl
+all: Makefile-pl $(GENERATOR_ML)
 	$(MAKE) -f Makefile-pl
 
 Makefile-pl: Makefile.PL
diff --git a/python/Makefile.am b/python/Makefile.am
index da52cfa..61f41ce 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -18,10 +18,18 @@
 # Old RHEL 5 autoconf doesn't have builddir.
 builddir ?= $(top_builddir)/python
 
-EXTRA_DIST = \
-	guestfs.py \
+GENERATOR_ML = \
 	guestfs-py.c \
-	bindtests.py \
+	guestfs.py \
+	bindtests.py
+
+.PHONY: force
+
+$(GENERATOR_ML): force
+	$(MAKE) -C $(top_builddir)/src stamp-generator
+
+EXTRA_DIST = \
+	$(GENERATOR_ML) \
 	run-bindtests \
 	run-python-tests \
 	t/*.py
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 7ea0107..37b1274 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -15,14 +15,22 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+GENERATOR_ML = \
+	ext/guestfs/_guestfs.c \
+	bindtests.rb
+
+.PHONY: force
+
+$(GENERATOR_ML): force
+	$(MAKE) -C $(top_builddir)/src stamp-generator
+
 EXTRA_DIST = \
+	$(GENERATOR_ML) \
 	Rakefile.in \
-	ext/guestfs/_guestfs.c \
 	ext/guestfs/extconf.rb \
 	lib/guestfs.rb \
 	run-bindtests \
 	run-ruby-tests \
-	bindtests.rb \
 	tests/tc_*.rb
 
 CLEANFILES = \
@@ -43,7 +51,7 @@ TESTS_ENVIRONMENT = \
 	LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
 	LIBGUESTFS_PATH=$(top_builddir)/appliance
 
-all:
+all: $(GENERATOR_ML)
 	rake build
 
 endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 469f6d6..09a9c7f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,12 +15,26 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-EXTRA_DIST = \
+GENERATOR_ML = \
 	guestfs_protocol.x \
+	guestfs-structs.h \
+	guestfs-actions.h \
+	guestfs-internal-actions.h \
+	guestfs-actions.c \
+	guestfs-bindtests.c
+
+$(GENERATOR_ML): stamp-generator
+
+BUILT_SOURCES = \
+  $(GENERATOR_ML) \
+  guestfs_protocol.c \
+  guestfs_protocol.h
+
+EXTRA_DIST = \
+	$(BUILT_SOURCES) \
 	MAX_PROC_NR \
 	stamp-generator \
-	generator.ml \
-	guestfs-internal-actions.h
+	generator.ml
 
 # Rerun the generator if it has changed.
 # Git removes empty directories, so in cases where the
@@ -34,21 +48,10 @@ stamp-generator: generator.ml
 	mkdir -p $(top_srcdir)/java/com/redhat/et/libguestfs
 	cd $(top_srcdir) && ocaml -warn-error A src/generator.ml
 
-guestfs_protocol.x: stamp-generator
-
 include_HEADERS = guestfs.h guestfs-actions.h guestfs-structs.h
 
 lib_LTLIBRARIES = libguestfs.la
 
-BUILT_SOURCES = \
-  guestfs_protocol.x \
-  guestfs_protocol.c \
-  guestfs_protocol.h \
-  guestfs-structs.h \
-  guestfs-actions.h \
-  guestfs-actions.c \
-  guestfs-bindtests.c
-
 # This convenience library is solely to avoid compiler warnings
 # in its generated sources.
 libprotocol_la_SOURCES = \
@@ -57,8 +60,6 @@ libprotocol_la_SOURCES = \
 
 libprotocol_la_CFLAGS =
 
-CLEANFILES = guestfs_protocol.c guestfs_protocol.h
-
 # From the libtool info file, with comments:
 #
 # |  1. Start with version information of `0:0:0' for each libtool library.
-- 
1.6.5.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]