On Wed, 2010-08-18 at 07:17 -0500, Peter Fales wrote:
> A user has complained about Makefiles that broke when we updated from 
> make-8.31 to make-3.82, demonstrated by this sample Makefile:

> Help %::
>         @$(ShowTargets)

> As I understand it, this is intended to catch the unspecifed target and
> print the help message.  When make-3.81 is used by running "make" it prints
> 
>       Hello World

Wouldn't using .DEFAULT be better/faster?  A catch-anything pattern rule
like that is very expensive.

> but 3.82 prints
> 
>       Makefile:7: *** mixed implicit and normal rules.  Stop.
> 
> I don't understand this well enough to know which is the correct behavior
> or what the error message is trying to tell me.   Is 3.82 working
> as expected?   Is there some more "correct" way to accomplish the same
> result? 

The previous behavior of mixing implicit and pattern rules in one line
like that was never supported or documented, but due to a "hole" in the
parser it worked for certain specific cases (for example, reversing that
line so the pattern comes first would not work, nor would adding extra
explicit targets after the pattern target).

In 3.82, the parser was tightened in this respect and that "hole" was
closed, hence you see this error.

The right way to fix this is to write two rules:

        Help:
                @$(ShowTargets)
        %::
                @$(ShowTargets)

However, as above if you can use .DEFAULT it would be much more
efficient.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psm...@gnu.org>          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


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to