Makefile race between jobs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
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@xxxxxxxxxx>
---
 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux