From owner-freebsd-current Thu Apr 19 8: 1:39 2001 Delivered-To: freebsd-current@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 7DD5237B42C; Thu, 19 Apr 2001 08:01:31 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.2/8.11.2) id f3JF19s21802; Thu, 19 Apr 2001 18:01:09 +0300 (EEST) (envelope-from ru) Date: Thu, 19 Apr 2001 18:01:09 +0300 From: Ruslan Ermilov To: Bruce Evans Cc: Makoto MATSUSHITA , current@FreeBSD.ORG, Will Andrews Subject: Re: make -jN bug (was: Re: groff breaks "make -j N buildworld") Message-ID: <20010419180109.B13567@sunbay.com> Mail-Followup-To: Bruce Evans , Makoto MATSUSHITA , current@FreeBSD.ORG, Will Andrews References: <20010419114853.B84456@sunbay.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from bde@zeta.org.au on Thu, Apr 19, 2001 at 11:38:49PM +1000 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Apr 19, 2001 at 11:38:49PM +1000, Bruce Evans wrote: > 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. > I stand corrected. The simple demo of this feature would be: foo: .SILENT VARIABLE=value echo $${VARIABLE} BTW, I have found the relevant info in the section 2.2 of the /usr/share/doc/psd/12.make/ paper: : Because all the commands are given to a single shell to execute, : such things as setting shell variables, changing directories, etc., ^^^^^^^^^^^^^^^^^^^^ : last beyond the command in which they are found. This also allows : shell compound commands (like ``for'' loops) to be entered in a : natural manner. Since this could cause problems for some makefiles : that depend on each command being executed by a single shell, PMake : has a -B flag (it stands for backwards-compatible) that forces each : command to be given to a separate shell. It also does several other : things, all of which I discourage since they are now old-fashioned. Thanks, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message