bug-make
[Top][All Lists]
Advanced

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

Re: ought to exist: by which rules?


From: Paul Smith
Subject: Re: ought to exist: by which rules?
Date: Sun, 11 Mar 2007 20:35:06 -0400

On Sat, 2007-03-10 at 01:44 +0300, Ilya N. Golubev wrote:
> Versions: 3.79.1, 3.81.
> 
> The definition of (file that is) <ought to exist> <(make) Implicit
> Rule Search> is ambiguous.  <file name is mentioned in the makefile as
> an explicit prerequisite> does not state, whether this means the
> prerequisite in rule in question or in any other rule in makefiles.

It means anywhere; otherwise it would have said something to limit the
scope to that particular rule.

However, there is something confusing about this; when it says "EXPLICIT
prerequisite" it means more than just the file name listed explicitly
(rather than as the result of applying a pattern); the file name must be
listed in an explicit rule (with or without commands).  In other words,
in this makefile:

  all: a.q
  %.q: b.r ; @echo cp $< $@

the file "b.r" is NOT an explicit prerequisite for the purposes of this
algorithm, since it appears only in an implicit rule.  However, in this
makefile:

  all: a.q b.r
  %.q: b.r ; @echo cp $< $@

"b.r" IS an explicit prerequisite, since it appears in an explicit rule
(for "all").

> make: Nothing to be done for `libb.a'.
> 
> make: *** No rule to make target `no_such_dir/libexternal.a', needed by 
> `libk.a'.  Stop.
> 
> What 3.81 does for `libb.a' is most dangerous.  The target may
> actually need update, but `make' will not tell that.

I was going to say that this is the correct behavior, but actually I see
that, according to the manual, it is not the correct behavior in this
particular case.

This version if make is deciding that since the prerequisites do not all
exist (in particular, ${external_libadd}), this implicit rule is not
applicable.  In that case, there are no implicit rules that are
applicable, and since the file already exists and make has no rule that
says how to build it that would show that it's out of date, make
concludes that it's up to date.

However, as you point out the documentation says:

       c. Test whether all the prerequisites exist or ought to exist.
          (If a file name is mentioned in the makefile as a target or
          as an explicit prerequisite, then we say it ought to exist.)

          If all prerequisites exist or ought to exist, or there are no
          prerequisites, then this rule applies.

It appears that this algorithm no longer works as documented, starting
with GNU make 3.81.  Please file a bug in Savannah about this, so we can
be sure to track it.

The correct behavior is the one you see in GNU make 3.80 and below.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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