diff mbox

Makefile race between jobs

Message ID 264C179F799EF24AB26D5319053335E80CC3049A11@ezexch.ezchip.com (mailing list archive)
State New, archived
Headers show

Commit Message

Noam Camus Nov. 17, 2012, 4:36 a.m. UTC
Hello Michal,

Here is my patch for dealing with race between 2 jobs of main 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 arch/<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(-)

--
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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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