From jnlin@tamama.org  Mon Mar  1 12:09:40 2010
Return-Path: <jnlin@tamama.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0E384106564A
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  1 Mar 2010 12:09:40 +0000 (UTC)
	(envelope-from jnlin@tamama.org)
Received: from Florence.tamama.org (Florence.tamama.org [59.120.212.55])
	by mx1.freebsd.org (Postfix) with ESMTP id A69418FC27
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  1 Mar 2010 12:09:39 +0000 (UTC)
Received: by Florence.tamama.org (Postfix, from userid 1000)
	id 3D0518A002; Mon,  1 Mar 2010 20:09:34 +0800 (CST)
Message-Id: <20100301120934.3D0518A002@Florence.tamama.org>
Date: Mon,  1 Mar 2010 20:09:34 +0800 (CST)
From: Jui-Nan Lin <jnlin@csie.nctu.edu.tw>
Reply-To: Jui-Nan Lin <jnlin@csie.nctu.edu.tw>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: different behavior of make(1) between command line argument and .MAKEFLAGS special target
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         144388
>Category:       bin
>Synopsis:       [patch] different behavior of make(1) between command line argument and .MAKEFLAGS special target
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 01 12:10:04 UTC 2010
>Closed-Date:    
>Last-Modified:  Mon Mar 01 15:50:45 UTC 2010
>Originator:     Jui-Nan Lin
>Release:        FreeBSD 8.0-RELEASE-p2 amd64
>Organization:
FreeBSD Taiwan
>Environment:
System: FreeBSD Florence.tamama.org 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #8: Thu Jan 7 11:34:24 CST 2010 root@Florence.tamama.org:/usr/obj/usr/src/sys/KERNEL amd64

>Description:
There's different behavior of specifying -j1 in command line argument and special target ".MAKEFLAGS"
>How-To-Repeat:

# cat Makefile
.MAKEFLAGS: -j1

all:
	@/bin/sleep 10 &
	@/bin/sleep 10 &
	@wait
# time make
0.000u 0.006s 0:00.01 0.0%      0+0k 0+0io 0pf+0w
# time make -j1
0.000u 0.006s 0:10.00 0.0%      0+0k 0+0io 0pf+0w
>Fix:
The behavior should be the same. (running for 10 seconds)


>Release-Note:
>Audit-Trail:

From: Garrett Cooper <yanefbsd@gmail.com>
To: Jui-Nan Lin <jnlin@csie.nctu.edu.tw>
Cc: "FreeBSD-gnats-submit@FreeBSD.org" <FreeBSD-gnats-submit@FreeBSD.org>
Subject: Re: bin/144388: different behavior of make(1) between command line argument and .MAKEFLAGS special target
Date: Mon, 1 Mar 2010 05:14:20 -0800

 On Mar 1, 2010, at 4:09 AM, Jui-Nan Lin <jnlin@csie.nctu.edu.tw> wrote:
 
 >
 >> Number:         144388
 >> Category:       bin
 >> Synopsis:       different behavior of make(1) between command line  
 >> argument and .MAKEFLAGS special target
 >> Confidential:   no
 >> Severity:       non-critical
 >> Priority:       low
 >> Responsible:    freebsd-bugs
 >> State:          open
 >> Quarter:
 >> Keywords:
 >> Date-Required:
 >> Class:          sw-bug
 >> Submitter-Id:   current-users
 >> Arrival-Date:   Mon Mar 01 12:10:04 UTC 2010
 >> Closed-Date:
 >> Last-Modified:
 >> Originator:     Jui-Nan Lin
 >> Release:        FreeBSD 8.0-RELEASE-p2 amd64
 >> Organization:
 > FreeBSD Taiwan
 >> Environment:
 > System: FreeBSD Florence.tamama.org 8.0-RELEASE-p2 FreeBSD 8.0- 
 > RELEASE-p2 #8: Thu Jan 7 11:34:24 CST 2010 root@Florence.tamama.org:/ 
 > usr/obj/usr/src/sys/KERNEL amd64
 >
 >> Description:
 > There's different behavior of specifying -j1 in command line  
 > argument and special target ".MAKEFLAGS"
 >> How-To-Repeat:
 >
 > # cat Makefile
 > .MAKEFLAGS: -j1
 >
 > all:
 >    @/bin/sleep 10 &
 >    @/bin/sleep 10 &
 >    @wait
 > # time make
 > 0.000u 0.006s 0:00.01 0.0%      0+0k 0+0io 0pf+0w
 > # time make -j1
 > 0.000u 0.006s 0:10.00 0.0%      0+0k 0+0io 0pf+0w
 >> Fix:
 > The behavior should be the same. (running for 10 seconds)
 
 Can you try adding a line continuation (\) to lines 1 and 2, and  
 remove the @ from lines 2 and 3?
 
 I agree that behavior should be the same, or at least in the same  
 ballpark, but I think the former version (0 seconds) is correct.
 
 Thanks,
 -Garrett

From: Jui-Nan Lin <jnlin@csie.nctu.edu.tw>
To: bug-followup@FreeBSD.org, yanefbsd@gmail.com
Cc:  
Subject: Re: bin/144388: different behavior of make(1) between command line 
	argument and .MAKEFLAGS special target
Date: Mon, 1 Mar 2010 21:36:56 +0800

 Hi Garrett,
 
 Following is the result:
 
 # cat Makefile
 .MAKEFLAGS: -j1
 
 all:
         /bin/sleep 10 & \
         /bin/sleep 10 &
         @wait
 
 # time make all
 /bin/sleep 10 &  /bin/sleep 10 &
 0.000u 0.006s 0:00.01 0.0%      0+0k 0+0io 0pf+0w
 # time make -j1 all
 /bin/sleep 10 &  /bin/sleep 10 &
 0.000u 0.007s 0:10.00 0.0%      0+0k 0+0io 0pf+0w
 
 The latter version is correct because when specifying "-j", make(1)
 only forks a shell for all commands. If no "-j" specified, make forks
 1 shell for each command. You can see manpage of make(1).

From: Jui-Nan Lin <jnlin@csie.nctu.edu.tw>
To: Garrett Cooper <yanefbsd@gmail.com>
Cc: "FreeBSD-gnats-submit@FreeBSD.org" <FreeBSD-gnats-submit@freebsd.org>
Subject: Re: bin/144388: different behavior of make(1) between command line 
	argument and .MAKEFLAGS special target
Date: Mon, 1 Mar 2010 22:28:23 +0800

 Hi,
 
 I have make a patch:
 http://www.csie.nctu.edu.tw/~jnlin/patch/usr.bin.make.c.patch
 It works for me.
>Unformatted:
