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

> 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.)


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to