help-make
[Top][All Lists]
Advanced

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

Re: Ordering targets as arguments


From: Luke Shumaker
Subject: Re: Ordering targets as arguments
Date: Sun, 14 Nov 2010 20:57:31 -0500

On Sat, 2010-11-13 at 23:58 +0100, Erik Rull wrote:
> Well yes - I could write a rule like
> copy_object: object
>       [....]
> 
> But this would mean that object gets executed also if I did not give it as 
> an argument to the make command.
> 
> I don't need a general handling of the sequence of the arguments only for 
> this special rule I want to have it executed after all other rules (also 
> with -j - not parallelized with the other stuff.

Order-only prereqs can help, but only if it is safe to assume that a
file `object' will exist -- that is, `object' is not a .PHONY target.
If it is, simply create a token/cookie for it, instead of making in
PHONY.

The reason the `object' file must exist is that order-only prereqs are
more accurately described as ignore-mtime prereqs (which is how they are
identified in the source) -- the file must exist, but the mod time is
never checked.  So, if object is PHONY, it will be run on copy_object,
where it won't if it is a real file.

So something like:

object: $(obj)
        [...]
        touch $@

copy_object: | object
        [...]

-- 
~ LukeShu
http://lukeshu.ath.cx/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]