Peter Fales | 18 Aug 14:17 2010

"mixed implicit and normal rules"

A user has complained about Makefiles that broke when we updated from 
make-8.31 to make-3.82, demonstrated by this sample Makefile:

====================================
define ShowTargets
        echo "Hello World!"
endef

.PHONY : Help

Help %::
         <at> $(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!

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? 

Thanks!

(Continue reading)

Paul Smith | 18 Aug 16:20 2010
Picon

Re: "mixed implicit and normal rules"

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 %::
>          <at> $(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).

(Continue reading)


Gmane