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

Re: [Xen-devel] [PATCH for-4.7] docs/build: Work around apparent bug with multi-target rules



Andrew Cooper writes ("[PATCH for-4.7] docs/build: Work around apparent bug 
with multi-target rules"):
> The `make` manual documents that a rule of the form
> 
>   target1 target2: prereq
>       recipe
> 
> is equivilent to
> 
>   target1: prereq
>       recipe
>   target2: prereq
>       recipe
> 
> This is correct if only target1 or target2 is wanted, but is not the
> case if both target1 and target2 are wanted to be rebuilt in the
> same pass.  In such a case, executing the recipe to generate target1
> causes the entire rule to be considered complete, short circuiting
> the search to regenerate target2.

This is not a bug in make.  From the manual I have here (wheezy):

     Suppose you would like to vary the prerequisites according to the
   target, much as the variable `$@' allows you to vary the commands.
   You cannot do this with multiple targets in an ordinary rule, but
   you can do it with a "static pattern rule".  *Note Static Pattern
   Rules: Static Pattern.

and (from `Pattern Intro'):

     Pattern rules may have more than one target.  Unlike normal
   rules, this does not act as many different rules with the same
   prerequisites and commands.  If a pattern rule has multiple
   targets, `make' knows that the rule's commands are responsible for
   making all of the targets.  The commands are executed only once to
   make all the targets.

So this is a bug in the Makefile.  Your patch looks like a right
approach to me.  A static pattern rule would be the other option.

Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.