[Libguestfs] [PATCH 4/5] build: Pull generator.ml refresh into Makefile.common

Matthew Booth mbooth at redhat.com
Thu Nov 19 13:55:17 UTC 2009


This changes moves the generator.ml in Makefile.common. It also improves the
rule by adding an intermediate dependency on the stamp-generator file. This
prevents the sub-make from being invoked once per source file.
---
 Makefile.am           |    3 ---
 Makefile.common       |    6 ++++++
 capitests/Makefile.am |    3 ---
 fish/Makefile.am      |    3 ---
 haskell/Makefile.am   |    3 ---
 ocaml/Makefile.am     |    3 ---
 perl/Makefile.am      |    3 ---
 python/Makefile.am    |    3 ---
 ruby/Makefile.am      |    3 ---
 9 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 204a91b..4b28610 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,9 +61,6 @@ generator_built = \
 	guestfs-actions.pod \
 	guestfish-actions.pod
 
-$(generator_built): force
-	$(MAKE) -C $(top_builddir)/src stamp-generator
-
 EXTRA_DIST = \
 	$(generator_built) \
 	guestfs.pod \
diff --git a/Makefile.common b/Makefile.common
index fe954e0..fd8bfef 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -21,3 +21,9 @@
 # Rebuild rules for common dependencies
 $(top_builddir)/src/libguestfs.la: force
 	$(MAKE) -C $(top_builddir)/src libguestfs.la
+
+# Automatically build targets defined in generator_built
+# generator_built is defined in individual Makefiles
+$(generator_built): $(top_builddir)/src/stamp-generator
+$(top_builddir)/src/stamp-generator: force
+	$(MAKE) -C $(top_builddir)/src stamp-generator
diff --git a/capitests/Makefile.am b/capitests/Makefile.am
index dd70d1a..cef44f8 100644
--- a/capitests/Makefile.am
+++ b/capitests/Makefile.am
@@ -19,9 +19,6 @@ include $(top_srcdir)/Makefile.common
 
 generator_built = tests.c
 
-$(generator_built): force
-	$(MAKE) -C $(top_builddir)/src stamp-generator
-
 BUILT_SOURCES = $(generator_built)
 
 EXTRA_DIST = $(BUILT_SOURCES)
diff --git a/fish/Makefile.am b/fish/Makefile.am
index d9eea5f..1bbb208 100644
--- a/fish/Makefile.am
+++ b/fish/Makefile.am
@@ -23,9 +23,6 @@ generator_built = \
 	cmds.c \
 	completion.c
 
-$(generator_built): force
-	$(MAKE) -C $(top_builddir)/src stamp-generator
-
 BUILT_SOURCES = \
 	$(generator_built) \
 	rc_protocol.h \
diff --git a/haskell/Makefile.am b/haskell/Makefile.am
index 978801a..ed75e62 100644
--- a/haskell/Makefile.am
+++ b/haskell/Makefile.am
@@ -21,9 +21,6 @@ generator_built = \
 	Guestfs.hs \
 	Bindtests.hs
 
-$(generator_built): force
-	$(MAKE) -C $(top_builddir)/src stamp-generator
-
 # $(generator_built) 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_built) *.hs run-bindtests
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 38fa35e..f1b4070 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -23,9 +23,6 @@ generator_built = \
 	guestfs_c_actions.c \
 	bindtests.ml
 
-$(generator_built): force
-	$(MAKE) -C $(top_builddir)/src stamp-generator
-
 EXTRA_DIST = \
 	$(generator_built) \
 	guestfs_c.c guestfs_c.h \
diff --git a/perl/Makefile.am b/perl/Makefile.am
index ccc1b85..32f0232 100644
--- a/perl/Makefile.am
+++ b/perl/Makefile.am
@@ -22,9 +22,6 @@ generator_built = \
 	lib/Sys/Guestfs.pm \
 	bindtests.pl
 
-$(generator_built): force
-	$(MAKE) -C $(top_builddir)/src stamp-generator
-
 EXTRA_DIST = \
 	$(generator_built) \
 	Makefile.PL.in \
diff --git a/python/Makefile.am b/python/Makefile.am
index 0cf99aa..7761d2b 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -25,9 +25,6 @@ generator_built = \
 	guestfs.py \
 	bindtests.py
 
-$(generator_built): force
-	$(MAKE) -C $(top_builddir)/src stamp-generator
-
 EXTRA_DIST = \
 	$(generator_built) \
 	run-bindtests \
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 5829dcc..4125381 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -21,9 +21,6 @@ generator_built = \
 	ext/guestfs/_guestfs.c \
 	bindtests.rb
 
-$(generator_built): force
-	$(MAKE) -C $(top_builddir)/src stamp-generator
-
 EXTRA_DIST = \
 	$(generator_built) \
 	Rakefile.in \
-- 
1.6.5.2




More information about the Libguestfs mailing list