parallel-subdirs.mak: snippet to include in Makefiles to build subdirectories in...
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 26 Mar 2010 19:42:41 +0000 (19:42 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Sun, 28 Mar 2010 23:17:46 +0000 (00:17 +0100)
Build sub-directories in parallel if make -jN is used. We'll descend
into the sub-directories a second time after the first parallel run,
but at that point there shouldn't be anything left to do. Assumes
there are no dependencies between any of the sub-directories.

parallel-subdirs.mak [new file with mode: 0644]

diff --git a/parallel-subdirs.mak b/parallel-subdirs.mak
new file mode 100644 (file)
index 0000000..36885df
--- /dev/null
@@ -0,0 +1,13 @@
+# include this at the end of $MODULE/ext/Makefile.am to force make to
+# build subdirectories in parallel when make -jN is used. We will end up
+# descending into all subdirectories a second time, but only after the first
+# (parallel) run has finished, so it should go right through the second time.
+
+.PHONY: independent-subdirs $(SUBDIRS)
+
+independent-subdirs: $(SUBDIRS)
+
+$(SUBDIRS):
+       $(MAKE) -C $@
+
+all-recursive: independent-subdirs