From owner-freebsd-current Thu Apr 19 6:39:56 2001 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 0EFB537B424; Thu, 19 Apr 2001 06:39:53 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id XAA05156; Thu, 19 Apr 2001 23:39:50 +1000 Date: Thu, 19 Apr 2001 23:38:49 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Ruslan Ermilov Cc: Makoto MATSUSHITA , current@FreeBSD.ORG, Will Andrews Subject: Re: make -jN bug (was: Re: groff breaks "make -j N buildworld") In-Reply-To: <20010419114853.B84456@sunbay.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 19 Apr 2001, Ruslan Ermilov wrote: > Attached is the Makefile that demonstrates the problem. Run it like this: > > make obj; make all > > Then try: > > make install > > And then try: > > make -j2 install > > Note the difference. This fixes the problem: > > --- Makefile Thu Apr 19 11:33:04 2001 > +++ Makefile Thu Apr 19 11:36:20 2001 > @@ -8,6 +8,7 @@ > beforeinstall: .SILENT > cd ${.CURDIR}; \ > ${INSTALL} ${COPY} -m ${NOBINMODE} Makefile ${DESTDIR}/tmp > + cd ${.OBJDIR} > pwd > ${INSTALL} ${COPY} -m ${NOBINMODE} foo ${DESTDIR}/tmp > > I'm not sure if this a make(1) bug or a feature, as both NetBSD and > OpenBSD behave the same. But I'm pretty sure this is a bug. Will? This is a feature of parallel make. Parallel make combines all of the commands for each target into a single shell command (if possible?). Thus `cd's in one command affect subsequent commands. This feature can be controlled using the undocumented .SINGLESHELL directive. Unfortunately, the implementation of .SINGLESHELL is too primitive for .SINGELSHELL to be worth using. Using it is equivalent to using -B to turn off -j. This has caused problems before. See the log message for rev.1.177 of src/Makefile for a more complicated example. (The problem for `cd's is obvious compared with the one for `&&'s. In the example in log message, the point of the `cd's is to maximise the damage caused by combining non- -j-aware commands. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message