From nobody@FreeBSD.org  Mon Oct 14 06:37:49 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 47BBA37B401
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 14 Oct 2002 06:37:49 -0700 (PDT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DC22343EAC
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 14 Oct 2002 06:37:48 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g9EDbm7R048852
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 14 Oct 2002 06:37:48 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.6/8.12.6/Submit) id g9EDbmwM048851;
	Mon, 14 Oct 2002 06:37:48 -0700 (PDT)
Message-Id: <200210141337.g9EDbmwM048851@www.freebsd.org>
Date: Mon, 14 Oct 2002 06:37:48 -0700 (PDT)
From: Liu Kang <lazykang@hotmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: make clean and make world or kernel should not be performanced concurrently.
X-Send-Pr-Version: www-1.0

>Number:         44053
>Category:       misc
>Synopsis:       make clean and make world or kernel should not be performanced concurrently.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 14 06:40:02 PDT 2002
>Closed-Date:    Mon Oct 14 06:53:20 PDT 2002
>Last-Modified:  Mon Oct 14 06:53:20 PDT 2002
>Originator:     Liu Kang
>Release:        4.7
>Organization:
Beijing Polytechnic University
>Environment:
FreeBSD ftp.bjpu.edu.cn 4.7-STABLE FreeBSD 4.7-STABLE #13: Thu Oct 10 02:24:10 CST 2002     lazy@ftp.bjpu.edu.cn:/usr/obj/usr/src/sys/FTP  i386
>Description:
      make clean and make world(kernel) should not be performanced at the same time. if so , make world would stop immediately.
>How-To-Repeat:
      just run "make world" and "make clean" at the same time.
>Fix:
I changed the Makefile in /usr/src as follow:


--- Makefile.orig       Mon Oct 14 21:04:12 2002
+++ Makefile    Mon Oct 14 21:05:37 2002
@@ -116,7 +116,7 @@
 #
 # Handle the user-driven targets, using the source relative mk files.
 #
-${TGTS} ${BITGTS}: upgrade_checks
+${TGTS} ${BITGTS}: ifmaking upgrade_checks
        @cd ${.CURDIR}; \
                ${MAKE} ${.TARGET}
 
@@ -130,7 +130,7 @@
 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
 # success, regardless of how old your existing system is.
 #
-world: upgrade_checks
+world:  ifmaking upgrade_checks
        @echo "--------------------------------------------------------------"
        @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
        @echo "--------------------------------------------------------------"
@@ -154,6 +154,7 @@
        @echo "--------------------------------------------------------------"
        @printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n                        (started ${STARTTIME})\n"
        @echo "--------------------------------------------------------------"
+       @rm /var/spool/lock/makeworld.lock
 
 #
 # kernel
@@ -180,6 +181,20 @@
            grep -q "Unknown modifier 'C'"; then \
                make make; \
        fi
+#
+# Perform a test to determine whether someone is running "make" in the source directory
+# in order to prevent run "make " and "make clean" at the same time.
+#
+ifmaking:
+        @ if [ -f /var/spool/lock/makeworld.lock ]; then \
+        echo "Please make sure you are the only one who run make at the time!"; \
+        echo "If you think you get this message by mistake , delete /var/spool/lock/makeworld.lock manualy and run make again."; \
+        kill $$PPID ;\
+ else\
+        touch /var/spool/lock/makeworld.lock;\
+ fi
+
+
 
 #
 # A simple test target used as part of the test to see if make supports
@@ -219,6 +234,6 @@
 
 upgrade:       aout-to-elf
 
-${UPGRADE} : upgrade_checks
+${UPGRADE} : ifmaking upgrade_checks
        @cd ${.CURDIR}; \
                ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ceri 
State-Changed-When: Mon Oct 14 06:52:53 PDT 2002 
State-Changed-Why:  
Duplicate of misc/44052. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44053 
>Unformatted:
