telepathy-gabble: Avoid having two of the same set of commands run in parallel

Simon McVittie smcv at kemper.freedesktop.org
Tue Jun 4 04:30:36 PDT 2013


Module: telepathy-gabble
Branch: master
Commit: d26688c2472ffe697e7495b2e480a1ca335ddce8
URL:    http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=d26688c2472ffe697e7495b2e480a1ca335ddce8

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon Jun  3 12:40:50 2013 +0100

Avoid having two of the same set of commands run in parallel

A rule like this:

    _gen/x.c _gen/x.h: prerequisites
        $(AM_V_GEN)x-generator

doesn't consider x.c and x.h together. Instead, it expands to two rules,
one to generate x.c and one to generate x.h, which happen to run the
same commands.

This means that in the worst case, you can end up running x-generator
twice in parallel, and they'll race with each other and overwrite or
delete each other's output.

Based on commit 36c2a545c from telepathy-glib.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=64285
Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>

---

 extensions/Makefile.am |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index ecb02ef..b435ae3 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -59,8 +59,11 @@ extensions.html: _gen/all.xml $(tools_dir)/doc-generator.xsl Makefile.am
 		$(tools_dir)/doc-generator.xsl \
 		$< > $@
 
-_gen/svc.c _gen/svc.h _gen/svc-gtk-doc.h: _gen/all.xml $(tools_dir)/glib-ginterface-gen.py \
-	Makefile.am
+_gen/svc.h: _gen/svc.c
+	@: # do nothing, output as a side-effect
+_gen/svc-gtk-doc.h: _gen/svc.c
+	@: # do nothing, output as a side-effect
+_gen/svc.c: _gen/all.xml $(tools_dir)/glib-ginterface-gen.py Makefile.am
 	$(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-ginterface-gen.py \
 		--filename=_gen/svc \
 		--include='<telepathy-glib/telepathy-glib.h>' \
@@ -68,18 +71,25 @@ _gen/svc.c _gen/svc.h _gen/svc-gtk-doc.h: _gen/all.xml $(tools_dir)/glib-ginterf
 		--not-implemented-func='tp_dbus_g_method_return_not_implemented' \
 		$< Gabble_Svc_
 
-_gen/enums.h _gen/enums-gtk-doc.h: _gen/all.xml $(tools_dir)/c-constants-gen.py \
-	Makefile.am
+_gen/enums-gtk-doc.h: _gen/enums.h
+	@: # do nothing, output as a side-effect
+_gen/enums.h: _gen/all.xml $(tools_dir)/c-constants-gen.py Makefile.am
 	$(AM_V_GEN)$(PYTHON) $(tools_dir)/c-constants-gen.py Gabble $< _gen/enums
 
-_gen/interfaces.h _gen/interfaces-body.h _gen/interfaces-gtk-doc.h: _gen/all.xml \
-	$(tools_dir)/glib-interfaces-gen.py \
-	Makefile.am
+_gen/interfaces-body.h: _gen/interfaces.h
+	@: # do nothing, output as a side-effect
+_gen/interfaces-gtk-doc.h: _gen/interfaces.h
+	@: # do nothing, output as a side-effect
+_gen/interfaces.h: _gen/all.xml $(tools_dir)/glib-interfaces-gen.py Makefile.am
 	$(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-interfaces-gen.py \
 		Gabble _gen/interfaces-body.h _gen/interfaces.h $<
 
-_gen/gtypes.h _gen/gtypes-body.h _gen/gtypes-gtk-doc.h: _gen/all.xml \
-	$(tools_dir)/glib-gtypes-generator.py Makefile.am
+_gen/gtypes.h: _gen/gtypes-body.h
+	@: # do nothing, output as a side-effect
+_gen/gtypes-gtk-doc.h: _gen/gtypes-body.h
+	@: # do nothing, output as a side-effect
+
+_gen/gtypes-body.h: _gen/all.xml $(tools_dir)/glib-gtypes-generator.py Makefile.am
 	$(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-gtypes-generator.py \
 		$< _gen/gtypes Gabble
 



More information about the telepathy-commits mailing list