On Mon, 2011-04-04 at 12:08 +0430, ali hagigat wrote:
> Please consider the following makefile and it result in 3.81:
> -----------------------------------------
> e12: e13
>       @echo 12complete        
> %13: e14
>       @echo 13complete_1
> %13: e14
>       @echo 13complete_2
> %14:
>       @echo 14complete
> e15:
>       @echo 15complete
> 
> 14complete
> 13complete_2
> 12complete
> -----------------------------------------
> Dear Paul, as you wrote in 3.81 the first pattern rule is executed
> according to the manual. But why the second recipe is executed in the
> above example?

>From the manual:
        You can override a built-in implicit rule (or one you have
        defined yourself) by defining a new pattern rule with the same
        target and prerequisites, but different commands.  When the new
        rule is defined, the built-in one is replaced.  The new rule's
        position in the sequence of implicit rules is determined by
        where you write the new rule.

> My second question is that why the recipe of pattern rules is taken
> differently with regular rules in 3.81? Please consider the following:
> -----------------------------------------
> e12: e13
>       @echo 12complete
> e13: e14
>       @echo 13complete_1
> e13: e15
>       @echo 13complete_2
> e14:
>       @echo 14complete
> e15:
>       @echo 15complete
> 
> 15complete
> 14complete
> 13complete_2
> 12complete
> -----------------------------------------

Did you look at the errors printed by GNU make when you try this
makefile?  That gives you the explanation.

> For regular targets, it continues to the last target. But for pattern
> targets it deals with the first target in 3.81!!

I don't know what this means.  As you show clearly in the first example,
it uses the second definition for pattern rules, not the first.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email protected]>          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


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to