Date: Mon, 20 Aug 2012 22:46:33 -0700 From: Garrett Cooper <yanegomi@gmail.com> To: "Simon J. Gerraty" <sjg@juniper.net> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ruslan Ermilov <ru@freebsd.org>, "David E. O'Brien" <obrien@freebsd.org> Subject: Re: svn commit: r238563 - head/gnu/usr.bin/groff/tmac Message-ID: <CAGH67wSGVt7vMz5NvH1HW3XWPf2PmwFJXr7Gqori1G4Ty=N2YQ@mail.gmail.com> In-Reply-To: <20120821053519.BD5A158085@chaos.jnpr.net> References: <201207180557.q6I5vheM034018@svn.freebsd.org> <20120726084903.GA48240@lo0.su> <20120821053519.BD5A158085@chaos.jnpr.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 20, 2012 at 10:35 PM, Simon J. Gerraty <sjg@juniper.net> wrote: > Hi, sorry about the slow response. > > On Thu, 26 Jul 2012 12:49:03 +0400, Ruslan Ermilov writes: >>On Wed, Jul 18, 2012 at 05:57:43AM +0000, David E. O'Brien wrote: >>> Author: obrien >>> Date: Wed Jul 18 05:57:42 2012 >>> New Revision: 238563 >>> URL: http://svn.freebsd.org/changeset/base/238563 >>> >>> Log: >>> a ";" tells make we want the shell to be used >>> >>> Submitted by: Simon Gerraty <sjg@juniper.net> >>> >>> Modified: >>> head/gnu/usr.bin/groff/tmac/Makefile >> >>I don't quite understand what this change does, could you elaborate? > > Sure. This is a consequence of bmake trying to be clever. > >>Without -jN (in backwards compatibility mode), the "cd" is a no-op >>(whether it's terminated by `;' or not) because make will execute a >>single shell per command, with cwd set to ${.OBJDIR}. > > Except on very weird systems, bmake is built in what NetBSD call > "native" mode, and even in compat mode will attempt to avoid the > overhead of all those shells. > Thus, unless it spots a shell meta char, it will try and skip the shell. > > Shell builtins like 'cd' or 'chdir' cannot be directly invoked, but make > doesn't know that. Simply adding the ';' convinces it to use a shell. > It is still a no-op. > >>With -jN, "cd" becomes necessary because all commands are executed as >>a script by one shell (the reason it was added in the first place), >>but adding `;' is a no-op because commands are on separate lines. > > A better way to construct targets like this is to put any excursion out > of .OBJDIR inside (): > > (cd ${.CURDIR} && \ > ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ > koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR}) > > then the cd ${.OBJDIR} isn't needed at all. > note use of && rather than ; which can be very dangerous In standard scripts I would agree. In FreeBSD pmake, I would disagree, but it seems that it's the odd man out: $ bmake -f ~/Makefile.bad false; echo hmmm hmmm $ gmake -f ~/Makefile.bad false; echo hmmm hmmm $ make -f ~/Makefile.bad false; echo hmmm *** [all] Error code 1 Stop in /scratch/p4/user/gcooper/atf-head. Cheers, -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wSGVt7vMz5NvH1HW3XWPf2PmwFJXr7Gqori1G4Ty=N2YQ>