linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Makefile race between jobs
@ 2012-11-16 13:40 Noam Camus
  2012-11-17  4:36 ` Noam Camus
  2012-12-09 16:14 ` Michal Marek
  0 siblings, 2 replies; 11+ messages in thread
From: Noam Camus @ 2012-11-16 13:40 UTC (permalink / raw)
  To: Noam Camus, mmarek@suse.cz; +Cc: linux-kbuild@vger.kernel.org

Hello Michael,

Here is my patch for dealing with race between 2 jobs of primary Makefile:

From 697f6ffa0d67b676fc2d75f65541c6e12108829d Mon Sep 17 00:00:00 2001
From: Noam Camus <noamc@ezchip.com>
Date: Fri, 16 Nov 2012 15:12:48 +0200
Subject: [PATCH] Makefile: solve race between make jobs.

Fix occasionally compilation failures when source tree is distcleaned.
The compilation is failing over file scripts/mod/empty.c

The error is because empty.o depends on some headers from:
	 arch/<arch>/include/generated/asm/

I see that there is a race between two targets in main Makefile (j=2):
	1) asm-generic
	2) scripts_basic

asm-generic:
	generates all wrappers in atch/<arch>/include/generated/asm/

scripts_basic:
	calls scripts/Makefile.build
	--> performs target __build
		--> depends on targets defined at variable $(always)
			--> compile scripts/mod/empty.c

Occasionally compilation of empty.c starts before all its required
headers created by asm-generic are available.

This dependency will make sure that this situation can not happen.

Signed-off-by: Noam Camus <noamc@ezchip.com>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 5be2ee8..00330a1 100644
--- a/Makefile
+++ b/Makefile
@@ -415,7 +415,7 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
 
 # Basic helpers built in scripts/
 PHONY += scripts_basic
-scripts_basic:
+scripts_basic: asm-generic
 	$(Q)$(MAKE) $(build)=scripts/basic
 	$(Q)rm -f .tmp_quiet_recordmcount
 
-- 
1.7.1

Please comment.

Noam Camus

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-12-10 11:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-16 13:40 Makefile race between jobs Noam Camus
2012-11-17  4:36 ` Noam Camus
2012-11-29 10:59   ` Noam Camus
2012-12-09 16:14 ` Michal Marek
     [not found]   ` <264C179F799EF24AB26D5319053335E80CC31B9D41@ezexch.ezchip.com>
2012-12-10  9:45     ` Michal Marek
2012-12-10 10:06       ` Noam Camus
2012-12-10 10:11       ` Vineet Gupta
2012-12-10 10:30         ` Michal Marek
2012-12-10 10:36           ` Vineet Gupta
2012-12-10 10:59             ` Arnd Bergmann
2012-12-10 11:23               ` Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).