Date: Mon, 13 Nov 2000 22:54:25 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Makoto MATSUSHITA <matusita@jp.FreeBSD.org> Cc: current@FreeBSD.ORG, stable@FreeBSD.ORG Subject: Re: "make modules" kicks the first module directory twice Message-ID: <Pine.BSF.4.21.0011132233320.803-100000@besplex.bde.org> In-Reply-To: <20001113195111R.matusita@jp.FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0011132233320.803-100000>