Patch 1/5 is a repost. Only change is title update. These fix parallel make on my machine, and additionally make building from subdirectories more correct.
Matthew Booth
2009-Nov-19 13:55 UTC
[Libguestfs] [PATCH 1/5] build: 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 changes the contents of the distribution tarball by including files created by rpcgen. 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..09f9217 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,9 +54,20 @@ if HAVE_HASKELL SUBDIRS += haskell endif +generator_built = \ + guestfs-structs.pod \ + guestfs-actions.pod \ + guestfish-actions.pod + +.PHONY: force + +$(generator_built): force + $(MAKE) -C $(top_builddir)/src stamp-generator + EXTRA_DIST = \ - guestfs.pod guestfs-actions.pod guestfs-structs.pod \ - guestfish.pod guestfish-actions.pod \ + $(generator_built) \ + 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..6bfce5d 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_built = tests.c + +.PHONY: force + +$(generator_built): force + $(MAKE) -C $(top_builddir)/src stamp-generator + +BUILT_SOURCES = $(generator_built) + +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..1716c2f 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_built = \ + actions.h \ + stubs.c \ + names.c + +.PHONY: force + +$(generator_built): force + $(MAKE) -C $(libsrcdir) stamp-generator + +BUILT_SOURCES = $(generator_built) + +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..962bc00 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -17,15 +17,27 @@ bin_PROGRAMS = guestfish +generator_built = \ + cmds.c \ + completion.c + +.PHONY: force + +$(generator_built): force + $(MAKE) -C $(top_builddir)/src stamp-generator + +BUILT_SOURCES = \ + $(generator_built) \ + rc_protocol.h \ + rc_protocol.c + EXTRA_DIST = \ + $(BUILT_SOURCES) \ rc_protocol.x -CLEANFILES = rc_protocol.c rc_protocol.h - guestfish_SOURCES = \ + $(generator_built) \ 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..01a78cb 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_built = \ + Guestfs.hs \ + Bindtests.hs + +.PHONY: force + +$(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 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..99fbe6b 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_built = \ + guestfs.mli \ + guestfs.ml \ + guestfs_c_actions.c \ + bindtests.ml + +.PHONY: force + +$(generator_built): 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_built) \ + 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..0a67269 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_built = \ + Guestfs.xs \ + lib/Sys/Guestfs.pm \ + bindtests.pl + +.PHONY: force + +$(generator_built): force + $(MAKE) -C $(top_builddir)/src stamp-generator + EXTRA_DIST = \ + $(generator_built) \ 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_built) $(MAKE) -f Makefile-pl Makefile-pl: Makefile.PL diff --git a/python/Makefile.am b/python/Makefile.am index da52cfa..9a5aab6 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_built = \ guestfs-py.c \ - bindtests.py \ + guestfs.py \ + bindtests.py + +.PHONY: force + +$(generator_built): force + $(MAKE) -C $(top_builddir)/src stamp-generator + +EXTRA_DIST = \ + $(generator_built) \ run-bindtests \ run-python-tests \ t/*.py diff --git a/ruby/Makefile.am b/ruby/Makefile.am index 7ea0107..ae18684 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_built = \ + ext/guestfs/_guestfs.c \ + bindtests.rb + +.PHONY: force + +$(generator_built): force + $(MAKE) -C $(top_builddir)/src stamp-generator + EXTRA_DIST = \ + $(generator_built) \ 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_built) rake build endif diff --git a/src/Makefile.am b/src/Makefile.am index 2774ffc..373f1d2 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_built = \ guestfs_protocol.x \ + guestfs-structs.h \ + guestfs-actions.h \ + guestfs-internal-actions.h \ + guestfs-actions.c \ + guestfs-bindtests.c + +$(generator_built): stamp-generator + +BUILT_SOURCES = \ + $(generator_built) \ + 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 -$(BUILT_SOURCES): 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
Matthew Booth
2009-Nov-19 13:55 UTC
[Libguestfs] [PATCH 2/5] build: Make java rebuild libguestfs.la if necessary
--- java/Makefile.am | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/java/Makefile.am b/java/Makefile.am index 4bda32c..0ca7f7c 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -70,6 +70,11 @@ libguestfs_jni_la_SOURCES = \ com_redhat_et_libguestfs_GuestFS.h \ com_redhat_et_libguestfs_GuestFS.c +.PHONY: force + +$(top_builddir)/src/libguestfs.la: force + make -C $(top_builddir)/src libguestfs.la + libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO) libguestfs_jni_la_CFLAGS = -Wall -I$(top_srcdir)/src -I$(top_builddir)/src $(JNI_CFLAGS) -- 1.6.5.2
Matthew Booth
2009-Nov-19 13:55 UTC
[Libguestfs] [PATCH 3/5] build: Add Makefile.common, ensure libguestfs.la is built when required
This patch adds a top level Makefile.common and includes it almost everywhere. It is not included in directories which aren't directly related to the top level build, for example the daemon. The force target moves into the new file. It also includes a new rule to rebuild libguestfs.la automatically as required. --- Makefile.am | 4 ++-- Makefile.common | 23 +++++++++++++++++++++++ appliance/Makefile.am | 2 ++ capitests/Makefile.am | 4 ++-- examples/Makefile.am | 2 ++ fish/Makefile.am | 4 ++-- fuse/Makefile.am | 2 ++ haskell/Makefile.am | 4 ++-- images/Makefile.am | 2 ++ inspector/Makefile.am | 2 ++ java/Makefile.am | 7 ++----- ocaml/Makefile.am | 4 ++-- perl/Makefile.am | 4 ++-- python/Makefile.am | 4 ++-- regressions/Makefile.am | 2 ++ ruby/Makefile.am | 4 ++-- src/Makefile.am | 2 ++ test-tool/Makefile.am | 2 ++ tools/Makefile.am | 2 ++ 19 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 Makefile.common diff --git a/Makefile.am b/Makefile.am index 09f9217..204a91b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + ACLOCAL_AMFLAGS = -I m4 SUBDIRS = gnulib/lib hivex src daemon appliance fish po examples images \ @@ -59,8 +61,6 @@ generator_built = \ guestfs-actions.pod \ guestfish-actions.pod -.PHONY: force - $(generator_built): force $(MAKE) -C $(top_builddir)/src stamp-generator diff --git a/Makefile.common b/Makefile.common new file mode 100644 index 0000000..fe954e0 --- /dev/null +++ b/Makefile.common @@ -0,0 +1,23 @@ +# libguestfs +# Copyright (C) 2009 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Define a force dependency which will always be rebuilt +.PHONY: force + +# Rebuild rules for common dependencies +$(top_builddir)/src/libguestfs.la: force + $(MAKE) -C $(top_builddir)/src libguestfs.la diff --git a/appliance/Makefile.am b/appliance/Makefile.am index b9bf953..aae3385 100644 --- a/appliance/Makefile.am +++ b/appliance/Makefile.am @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + EXTRA_DIST = \ libguestfs-supermin-helper \ kmod.whitelist.in \ diff --git a/capitests/Makefile.am b/capitests/Makefile.am index 6bfce5d..dd70d1a 100644 --- a/capitests/Makefile.am +++ b/capitests/Makefile.am @@ -15,9 +15,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -generator_built = tests.c +include $(top_srcdir)/Makefile.common -.PHONY: force +generator_built = tests.c $(generator_built): force $(MAKE) -C $(top_builddir)/src stamp-generator diff --git a/examples/Makefile.am b/examples/Makefile.am index adbb934..c6252e3 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,5 +1,7 @@ # libguestfs examples +include $(top_srcdir)/Makefile.common + noinst_PROGRAMS = hello to-xml hello_SOURCES = hello.c diff --git a/fish/Makefile.am b/fish/Makefile.am index 962bc00..d9eea5f 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -15,14 +15,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + bin_PROGRAMS = guestfish generator_built = \ cmds.c \ completion.c -.PHONY: force - $(generator_built): force $(MAKE) -C $(top_builddir)/src stamp-generator diff --git a/fuse/Makefile.am b/fuse/Makefile.am index d582c65..b6cbe88 100644 --- a/fuse/Makefile.am +++ b/fuse/Makefile.am @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + EXTRA_DIST = guestmount.pod test-fuse.sh if HAVE_FUSE diff --git a/haskell/Makefile.am b/haskell/Makefile.am index 01a78cb..978801a 100644 --- a/haskell/Makefile.am +++ b/haskell/Makefile.am @@ -15,12 +15,12 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + generator_built = \ Guestfs.hs \ Bindtests.hs -.PHONY: force - $(generator_built): force $(MAKE) -C $(top_builddir)/src stamp-generator diff --git a/images/Makefile.am b/images/Makefile.am index ff6bc5d..19ae9b6 100644 --- a/images/Makefile.am +++ b/images/Makefile.am @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + # Old RHEL 5 autoconf doesn't have builddir. builddir ?= $(top_builddir)/images diff --git a/inspector/Makefile.am b/inspector/Makefile.am index 058e565..1d210bb 100644 --- a/inspector/Makefile.am +++ b/inspector/Makefile.am @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + EXTRA_DIST = \ run-inspector-locally \ virt-inspector \ diff --git a/java/Makefile.am b/java/Makefile.am index 0ca7f7c..fe1476a 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + # Old RHEL 5 autoconf doesn't have builddir. builddir ?= $(top_builddir)/java @@ -70,11 +72,6 @@ libguestfs_jni_la_SOURCES = \ com_redhat_et_libguestfs_GuestFS.h \ com_redhat_et_libguestfs_GuestFS.c -.PHONY: force - -$(top_builddir)/src/libguestfs.la: force - make -C $(top_builddir)/src libguestfs.la - libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO) libguestfs_jni_la_CFLAGS = -Wall -I$(top_srcdir)/src -I$(top_builddir)/src $(JNI_CFLAGS) diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am index 99fbe6b..38fa35e 100644 --- a/ocaml/Makefile.am +++ b/ocaml/Makefile.am @@ -15,14 +15,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + generator_built = \ guestfs.mli \ guestfs.ml \ guestfs_c_actions.c \ bindtests.ml -.PHONY: force - $(generator_built): force $(MAKE) -C $(top_builddir)/src stamp-generator diff --git a/perl/Makefile.am b/perl/Makefile.am index 0a67269..ccc1b85 100644 --- a/perl/Makefile.am +++ b/perl/Makefile.am @@ -15,13 +15,13 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + generator_built = \ Guestfs.xs \ lib/Sys/Guestfs.pm \ bindtests.pl -.PHONY: force - $(generator_built): force $(MAKE) -C $(top_builddir)/src stamp-generator diff --git a/python/Makefile.am b/python/Makefile.am index 9a5aab6..0cf99aa 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -18,13 +18,13 @@ # Old RHEL 5 autoconf doesn't have builddir. builddir ?= $(top_builddir)/python +include $(top_srcdir)/Makefile.common + generator_built = \ guestfs-py.c \ guestfs.py \ bindtests.py -.PHONY: force - $(generator_built): force $(MAKE) -C $(top_builddir)/src stamp-generator diff --git a/regressions/Makefile.am b/regressions/Makefile.am index 058b60d..d861c54 100644 --- a/regressions/Makefile.am +++ b/regressions/Makefile.am @@ -21,6 +21,8 @@ # # See also capitests/ +include $(top_srcdir)/Makefile.common + TESTS = \ rhbz503169c10.sh \ rhbz503169c13.sh \ diff --git a/ruby/Makefile.am b/ruby/Makefile.am index ae18684..5829dcc 100644 --- a/ruby/Makefile.am +++ b/ruby/Makefile.am @@ -15,12 +15,12 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + generator_built = \ ext/guestfs/_guestfs.c \ bindtests.rb -.PHONY: force - $(generator_built): force $(MAKE) -C $(top_builddir)/src stamp-generator diff --git a/src/Makefile.am b/src/Makefile.am index 373f1d2..01fe384 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + generator_built = \ guestfs_protocol.x \ guestfs-structs.h \ diff --git a/test-tool/Makefile.am b/test-tool/Makefile.am index 510a42f..549e232 100644 --- a/test-tool/Makefile.am +++ b/test-tool/Makefile.am @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + EXTRA_DIST = libguestfs-test-tool.pod CLEANFILES diff --git a/tools/Makefile.am b/tools/Makefile.am index f48edae..88aad54 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +include $(top_srcdir)/Makefile.common + tools = cat df edit ls rescue tar win-reg EXTRA_DIST = \ -- 1.6.5.2
Matthew Booth
2009-Nov-19 13:55 UTC
[Libguestfs] [PATCH 4/5] build: Pull generator.ml refresh into Makefile.common
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
Matthew Booth
2009-Nov-19 13:55 UTC
[Libguestfs] [PATCH 5/5] build: Put locking round generator.ml invocation
Running multiple instances of generator.ml simultaneously can cause failure and/or corruption. This change puts a simple flock around it to ensure this doesn't happen during a parallel make. --- src/Makefile.am | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 01fe384..a6eed9d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -48,7 +48,7 @@ stamp-generator: generator.ml mkdir -p $(top_srcdir)/perl/lib/Sys mkdir -p $(top_srcdir)/ruby/ext/guestfs mkdir -p $(top_srcdir)/java/com/redhat/et/libguestfs - cd $(top_srcdir) && ocaml -warn-error A src/generator.ml + cd $(top_srcdir) && flock generator.lock ocaml -warn-error A src/generator.ml include_HEADERS = guestfs.h guestfs-actions.h guestfs-structs.h -- 1.6.5.2