help-make
[Top][All Lists]
Advanced

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

Re: Pattern and explicit prerequisites in one rule not mixable?


From: Philip Guenther
Subject: Re: Pattern and explicit prerequisites in one rule not mixable?
Date: Wed, 17 Feb 2010 13:05:18 -0800

On Wednesday, February 17, 2010, Frank Winter <address@hidden> wrote:
> I issued this some days ago. Now I boiled the problem down to a very simple 
> makefile example. It seems to me that to a pattern rule one can not add an 
> explicit prerequiste. Take a look at this:
...
> For some reason, make prefers to apply a built-in rule rather than the 
> "mixed" implicit-explicit rule.
>
> Is this a bug or a feature?

It's the documented behavior and I personally have written Makefiles
that rely on this behavior, so I think at this point it's a feature.

Here's what the docs say, at the bottom of section "10.5.1
Introduction to Pattern Rules":
---
The order in which pattern rules appear in the makefile is important
since this is the order in which they are considered. Of equally
applicable rules, only the first one found is used. The rules you
write take precedence over those that are built in. Note however, that
a rule whose prerequisites actually exist or are mentioned always
takes priority over a rule with prerequisites that must be made by
chaining other implicit rules.
---

You should just use one of the methods you already found to cancel the
builtin rule, giving you the desired behaviour.


Philip Guenther




reply via email to

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