tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: make .ORDER



On Tue, Jan 22, 2013 at 06:00:11PM +0100, Edgar Fu? wrote:
 > Is there a sane way to have target A built before target B without
 > having B depend on A? Is .ORDER A B guaranteed to do that? The
 > description of .ORDER says "The ordering imposed by .ORDER is only
 > relevant for parallel makes."  Does that mean it only imposes the
 > ordering restrictions for parallel makes or the author of the
 > manpage couldn't think of an example other that parallel makes
 > where you will want a particular order without a dependency?

In a non-parallel make it's sufficient to write

   X: A B

and it will always do A before B.

 > In my case, A is a directory containing B. The rules for A install
 > -d and the rules for B install /dev/null. With B depending on A, B
 > will be wiped out whenever you touch another file in directory A.
 > 
 > Probably there's a more elegant way to acheive the same thing.

One way is to use touch to create B, so extra runs don't do any
(serious) harm. I wouldn't call that *more* elegant though.

Another way is to forget the rule for A and write something like

   B:
        [ -d A ] || install -d A
        install -c /dev/null B

but that's also hackish.

IME using make rules for directories never works all that well,
though.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index