telepathy-mission-control: codegen: avoid generating more than one thing in the same command

Simon McVittie smcv at kemper.freedesktop.org
Mon Feb 3 08:26:43 PST 2014


Module: telepathy-mission-control
Branch: master
Commit: 8083503553ee039f7a203c9a5db00b61c0bda3a9
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=8083503553ee039f7a203c9a5db00b61c0bda3a9

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu Jan 30 13:04:56 2014 +0000

codegen: avoid generating more than one thing in the same command

As with telepathy-glib commit 36c2a545c9, 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.

Updated version of a patch from Ross Burton, taking into account that
we now generate a separate header for the gtk-doc. I use the gtk-doc
header as the one that "matters", because it's the last to be generated.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69446
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>

---

 src/Makefile.am |   24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index b89b973..22b1bbf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -222,7 +222,13 @@ _gen/interfaces-body.h: _gen/mcd.xml \
 		$(tools_dir)/glib-interfaces-body-generator.xsl \
 		$< > $@
 
-_gen/gtypes.h _gen/gtypes-body.h: _gen/mcd.xml \
+_gen/gtypes.h: _gen/gtypes-gtk-doc.h
+	@: # generated as a side-effect
+
+_gen/gtypes-body.h: _gen/gtypes-gtk-doc.h
+	@: # generated as a side-effect
+
+_gen/gtypes-gtk-doc.h: _gen/mcd.xml \
 	$(top_srcdir)/tools/glib-gtypes-generator.py
 	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/tools/glib-gtypes-generator.py \
 		$< _gen/gtypes mc
@@ -243,7 +249,13 @@ _gen/%.xml: %.xml $(wildcard $(top_srcdir)/xml/*.xml) Makefile.am
 	$(AM_V_GEN)$(XSLTPROC) $(XSLTPROCFLAGS) --xinclude $(tools_dir)/identity.xsl \
 		$< > $@
 
-_gen/cli-%-body.h _gen/cli-%.h: _gen/%.xml \
+_gen/cli-%-body.h: _gen/cli-%-gtk-doc.h
+	@: # generated as a side-effect
+
+_gen/cli-%.h: _gen/cli-%-gtk-doc.h
+	@: # generated as a side-effect
+
+_gen/cli-%-gtk-doc.h: _gen/%.xml \
 	$(tools_dir)/glib-client-gen.py Makefile.am
 	$(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-client-gen.py \
 		--group=`echo $* | tr x- x_` \
@@ -251,7 +263,13 @@ _gen/cli-%-body.h _gen/cli-%.h: _gen/%.xml \
 		--tp-proxy-api=0.7.6 \
 		$< Mc_Cli _gen/cli-$*
 
-_gen/svc-%.c _gen/svc-%.h: _gen/%.xml \
+_gen/svc-%.c: _gen/svc-%-gtk-doc.h
+	@: # generated as a side-effect
+
+_gen/svc-%.h: _gen/svc-%-gtk-doc.h
+	@: # generated as a side-effect
+
+_gen/svc-%-gtk-doc.h: _gen/%.xml \
 	$(tools_dir)/glib-ginterface-gen.py Makefile.am
 	$(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-ginterface-gen.py \
 		--filename=_gen/svc-$* \



More information about the telepathy-commits mailing list