summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
blob: 213820a104e76f2ce08495a8396edf6addfc7ea5 (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
gcc/Makefile.in: fix parallel building failure

Most C source files included config.h which was generated by a rule.
But no related prerequisites was added to the C source compiling rule.
There was potential building failure while makefile enabled parallel.

The C source compiling rule used suffix rule '.c.o', but the suffix
rule doesn't support prerequisites.
https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html

We used the pattern rule '%.o : %.c' to instead, and add the config.h
as its prerequisite

We also moved the '%.o : %.c' rule down to the 'build/%.o :' rule, which
makes '%.o : %.c' rule doesn't override 'build/%.o :'.

Upstream-Status: Pending

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 gcc/Makefile.in | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6475cba..04889fe 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1054,10 +1054,6 @@ COMPILE = source='$<' object='$@' libtool=no \
 POSTCOMPILE =
 endif
 
-.cc.o .c.o:
-	$(COMPILE) $<
-	$(POSTCOMPILE)
-
 #
 # Support for additional languages (other than C).
 # C can be supported this way too (leave for later).
@@ -2342,6 +2338,14 @@ build/%.o :  # dependencies provided by explicit rule later
 	$(COMPILER_FOR_BUILD) -c $(BUILD_COMPILERFLAGS) $(BUILD_CPPFLAGS) \
 		-o $@ $<
 
+%.o: %.c $(CONFIG_H)
+	$(COMPILE) $<
+	$(POSTCOMPILE)
+
+%.o: %.cc $(CONFIG_H)
+	$(COMPILE) $<
+	$(POSTCOMPILE)
+
 ## build/version.o is compiled by the $(COMPILER_FOR_BUILD) but needs
 ## several C macro definitions, just like version.o
 build/version.o:  version.c version.h \
-- 
1.8.1.2