bug-make
[Top][All Lists]
Advanced

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

Re: % vs. "No rule to make target"


From: Philip Guenther
Subject: Re: % vs. "No rule to make target"
Date: Fri, 6 Jun 2008 09:13:29 -0600

On Fri, Jun 6, 2008 at 5:49 AM,  <address@hidden> wrote:
> All is well:
>  $ cat Makefile
>  all:z.bak
>  %.bak:;
>  $ make
>  make: Nothing to be done for `all'.
> Until we add a %:
>  $ cat Makefile
>  all:z.bak
>  %.bak:%;
>  $ make
>  make: *** No rule to make target `z.bak', needed by `all'.  Stop.
> Suddenly it can't find the rule anymore. Or prints the wrong message.

Perhaps the message should say "No _applicable_ rule to make
target...".  Note that make doesn't suggest that "z" is missing
because it has no particular reason to believe that that is the
missing source file: with that Makefile, make can visualize a way to
create z.bak from 9 different source files:
    z
    z.bak,v
    RCS/z.bak,v
    s.z.bak
    SCCS/s.z.bak
    z,v
    RCS/z,v
    s.z
    SCCS/s.z

(For a file without a suffix, the default rules give make 70+ source
files to check for.)

...
> But
>  %.bak:some_file_that_does_not_exist;
> then make says it can't find the rule to make target z.bak, when it
> should say it can't find the rule to make target 
> some_file_that_does_not_exist,
> which it does when one uses
>  z.bak:some_file_that_does_not_exist;

There are several pattern rules that match "z.bak"; make cannot read
the Makefile author's mind, so it cannot be 100% sure which of those
rules (if any!) was the intended match for this file.  Making a
misleading claim that file B is missing when it's really file A that's
missing, or worse, it's pattern rule C that should have matched but
didn't because of a typo, is going to hinder more than it will help.


Philip Guenther




reply via email to

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