[Top][All Lists]

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

Re: incorrect errors being printed in make

From: Paul D. Smith
Subject: Re: incorrect errors being printed in make
Date: Thu, 30 Nov 2000 12:50:00 -0500

%% seph <address@hidden> writes:

  s> gmake seems to print the wrong error message. 

  s> ZONES=zone-masters/foo.com zone-masters/bar.com

  s> zone-masters/%: zone-pieces/%
  s>            ./bin/check-zones.pl < $<
  s>            cp $< $@

  s> zone-files/%.in-addr.arpa: $(ZONES)
  s>            ./bin/gen-zones.pl -r $*  $^ > $@

  s> zone-files/10.in-addr.arpa depends on $(ZONES), each of which is a
  s> file in zone-masters, which depends on zone-pieces. make does not know
  s> how to create files in zone-pieces. 

  s> if something is missing from zone-pieces, such that it can't be built
  s> in zone-masters, and prevents zone-files/10.in-addr.arpa from being
  s> built, I expect make to tell me it doesn't know how to make the bit in
  s> zone-pieces, instead it tells me:

  s> make: *** No rule to make target `zone-files/10.in-addr.arpa'.  Stop.

It would be nice if make could print the right message here;
unfortunately it really can't.

Make doesn't have any idea that these particular implicit rules are the
correct rules to be using to build the target.  The _only_ way make will
match an implicit rule is if the target pattern matches the target to be
built, and the resulting prerequisite patterns exist or can be created.
If that's true, make will use that implicit rule.  If it's not true,
make will continue searching for another implicit rule.  If make can't
find any implicit rule that can build the target, it will give the "no
rule to make target" error.

Consider that you might, and often do, have a large number of ways to
build any given target: you could build it using a user-defined implicit
rule (and sometimes there are more than one of these for the same
target: consider building a .o from a .c, a .cc, a .s, .f, .p,
etc. etc.), or from various builtin implicit rules (check it out from
source control, etc.)

Given that make might check 5 or more implicit rules where the target
pattern matches, how should it decide which of these is the "right" path
to follow down and generate messages about that prerequisite, rather
than the original target?

 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "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]