On Sun, 2011-04-03 at 13:42 +0430, ali hagigat wrote:
> If I have two pattern rules for a target in a makefile, which one will
> be selected?

Before 3.82, the GNU make manual says:

           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.


In 3.82 a more intelligent scheme is used: the GNU make manual says:

        It is possible that more than one pattern rule will meet these
        criteria.  In that case, @code{make} will choose the rule with
        the shortest stem (that is, the pattern that matches most
        specifically). If more than one pattern rule has the shortest
        stem, @code{make} will choose the first one found in the
        makefile.

However, we've seen incompatibilities and problems with this.  It's not
clear exactly how this will play out.

Most of the time rules can easily be written to work the same in both
versions.

-- 
-------------------------------------------------------------------------------
 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