help-make
[Top][All Lists]
Advanced

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

Re: Setting target execution order


From: Noel Yap
Subject: Re: Setting target execution order
Date: Mon, 24 Nov 2003 22:49:03 -0500

Matt Perry wrote:
> 
> On Mon, 24 Nov 2003, Noel Yap wrote:
> 
> > Can you supply a /really/ stripped down version and provide explanations
> > as to why creating prereq's for the target "gzip" won't work in your
> > situation?
> 
> Sorry about the previous makefile.  Here's a better one:
> 
> a:
>         touch a
> 
> b:
>         touch b
> 
> all: a b
> 
> gzip:
>         -gzip a
>         -gzip b
> 
> What I want to do is optionally add 'gzip' at the end of my target list.
> gzip can't have any prerequisites because I might only want to build a, or
> only build b.  I was just hoping to have some error checking so that if
> gzip was present and wasn't the last target, it could be moved to the last
> target.  I tried manipulating MAKECMDGOALS but it appears that variable is
> for reference only.  Is there a way to change the order of the goals from
> within the makefile or am I best off just exiting with a warning if the
> targets aren't in the order I need?

I see.  I think Paul has a RFE about optional prereq's that sounds like exactly 
what you want.

I'm not sure what you mean by reference only.  Have you tried:

gzip: $(filter-out gzip,$(MAKECMDGOALS))

Also, I had meant to say this before, but got distracted, you can't rely on the 
order of target invocation.  For example, what if --jobs were used?

HTH,
Noel




reply via email to

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