From owner-freebsd-stable Mon Nov 13 3:53:48 2000 Delivered-To: freebsd-stable@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 0317A37B479; Mon, 13 Nov 2000 03:53:41 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id WAA28070; Mon, 13 Nov 2000 22:53:30 +1100 Date: Mon, 13 Nov 2000 22:54:25 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Makoto MATSUSHITA Cc: current@FreeBSD.ORG, stable@FreeBSD.ORG Subject: Re: "make modules" kicks the first module directory twice In-Reply-To: <20001113195111R.matusita@jp.FreeBSD.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, 13 Nov 2000, Makoto MATSUSHITA wrote: > bde> (In the above example, the targets are built concurrently and race > bde> each other. This is bad when the `all' target wins the race. The > bde> `obj' target runs faster, so it usually wins the race except in the > bde> first directory (3dfx)). More .ORDER statements in *.mk are required. > > Thank you for giving us a details of this problem. But can we fix this > problem with .ORDER statements? Putting ".ORDER: obj all" or alike to > Makefile doesn't fix to me (maybe I misunderstand the usage of .ORDER > statement)... It didn't work for me either :-). I put it in bsd.obj.mk near the `obj' target, with the idea that this would cover all uses of the obj target. The problem seems to be that we both put it in the wrong place. I think it needs to be in bsd.subdir.mk for this case and in bsd.obj.mk for most cases. > bde> `&&' should never be used in shell commands in makefiles, although it > bde> may be only a bad example. This is because multiple commands are > bde> executed in the same shell in the -j case, and `&&' gives non-simple > bde> commands which may defeat the shell's -e setting. > > What should we do if we want to check the existence of a directory and > kick one (not two or more) command after chdir to that directory? Much > Makefiles in our FreeBSD repository employ "cd ${dir} && command" to > do this... Should we say > > if [ -d ${dir} ]; then \ > (cd ${dir}; command) \ > else > false > fi > > or exist() directive of make(1) ? Just use a semicolon instead of "&&" ("cd foo; command"). This gives multiple single commands, and make(1) execs sh(1) with -e, so the shell exits if any of the simple commands fails. ("simple" here is a technical term. See sh.1.) Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message