summaryrefslogtreecommitdiff
blob: 28eef07fbb3c9fecb9174c173492d41bea4d6111 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 7af14d9ca148e4d1ec2eb70d7b655bb2fc5a052f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Cardona?= <remi@gentoo.org>
Date: Sun, 30 Nov 2014 22:10:59 +0100
Subject: [PATCH] Fix parallel build in extensions/
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

GNU Make manual says:

    A rule with multiple targets is equivalent to writing many rules,
    each with one target, and all identical aside from that.

In other words, make may very well call glib-gtypes-generator.py twice
(once for each generated header). And hell breaks loose because the
python code assumes it will run once (it should be using the tempfile
module, but that's another bug). On a fast multi-core machine, make -j4
will easily reproduce this bug.

The solution is hidden in the same manual [1] :

    %.tab.c %.tab.h: %.y
            bison -d $<

    This tells make that the recipe ‘bison -d x.y’ will make both
    x.tab.c and x.tab.h.

So by using '%' to replace the 'y' in the targets, I'm telling make that
running the recipe once will generate both files.

[1] http://www.gnu.org/software/make/manual/make.html#Pattern-Examples

https://bugs.gentoo.org/show_bug.cgi?id=515894
https://bugzilla.gnome.org/show_bug.cgi?id=685837

Signed-off-by: Gilles Dartiguelongue <eva@gentoo.org>
---
 extensions/Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index 79622d4..9082496 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -66,7 +66,7 @@ extensions.html: _gen/all.xml $(tools_dir)/doc-generator.xsl
 		$(tools_dir)/doc-generator.xsl \
 		$< > $@
 
-_gen/gtypes.h _gen/gtypes-body.h: _gen/all.xml \
+_gen/gt%pes.h _gen/gt%pes-body.h: _gen/all.xml \
 	$(top_srcdir)/tools/glib-gtypes-generator.py
 	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/tools/glib-gtypes-generator.py \
 		$< _gen/gtypes Emp
@@ -82,7 +82,7 @@ _gen/enums.h: _gen/all.xml \
 		Emp \
 		$< _gen/enums
 
-_gen/interfaces-body.h _gen/interfaces.h: _gen/all.xml \
+_gen/int%rfaces-body.h _gen/int%rfaces.h: _gen/all.xml \
 	$(tools_dir)/glib-interfaces-gen.py
 	$(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-interfaces-gen.py \
 		Emp _gen/interfaces-body.h _gen/interfaces.h $<
-- 
2.3.6