help-make
[Top][All Lists]
Advanced

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

Re: Ordering targets as arguments


From: Paul Smith
Subject: Re: Ordering targets as arguments
Date: Sun, 14 Nov 2010 15:48:09 -0500

On Sat, 2010-11-13 at 23:58 +0100, Erik Rull wrote:
> how can I force make to "sort" targets that were given as arguments?
> 
> e.g. I want to type at prompt
> make object obj=test copy_object
> What should happen:
> object gets executed and afterwards copy_object gets executed
> 
> 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.
> 
> Any ideas?

You haven't fully defined when you want (and don't want) these targets
to be run, so I can't be sure, but it sounds like you might want to use
order-only prerequisites:

        copy_object: | object

See the GNU make manual.

Another option is to use $(filter ...) with the MAKECMDGOALS variable,
something like:

        copy_object: $(filter object,$(MAKECMDGOALS))

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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