summaryrefslogtreecommitdiffstats
path: root/subdir-rules.mk
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2009-11-19 16:10:00 +0000
committerRichard Jones <rjones@redhat.com>2009-11-19 16:40:22 +0000
commitc477e2fb78347728aaacbbc89666dcda1481a4b9 (patch)
tree125a0e0b2596cc9f9ad44fa57199522f4c0de804 /subdir-rules.mk
parent16c1b3164698900f52294e1396542ddd94a4cae4 (diff)
downloadlibguestfs-c477e2fb78347728aaacbbc89666dcda1481a4b9.tar.gz
libguestfs-c477e2fb78347728aaacbbc89666dcda1481a4b9.tar.xz
libguestfs-c477e2fb78347728aaacbbc89666dcda1481a4b9.zip
build: Fix inter-directory dependencies
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. It also adds a build rule for src/libguestfs.la so it can be rebuilt as required from other directories. It does this by creating a top level make file, subdir-rules.mk, which can be included from sub-directories. sub-directories need to define 'generator_built' to include local files which are built by generator.ml, and they will be updated automatically. 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. This patch also changes the contents of the distribution tarball by including files created by rpcgen.
Diffstat (limited to 'subdir-rules.mk')
-rw-r--r--subdir-rules.mk29
1 files changed, 29 insertions, 0 deletions
diff --git a/subdir-rules.mk b/subdir-rules.mk
new file mode 100644
index 00000000..fd8bfef4
--- /dev/null
+++ b/subdir-rules.mk
@@ -0,0 +1,29 @@
+# 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
+
+# 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