[Top][All Lists]

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

Re: Cancelling implicit rules

From: Paul D. Smith
Subject: Re: Cancelling implicit rules
Date: Mon, 30 Oct 2000 13:42:30 -0500

%% Thorstein Thorsteinsson <address@hidden> writes:

  tt> I am trying to override the implicit rules already
  tt> defined by gnumake, and instead create my own defining
  tt> the sequence %.f -> %.F -> %.o.

  tt> %.f: %.F ;
  tt> %.o: %.f ;

The above is not the proper way to delete an implicit rule.  The manual

     You can cancel a built-in implicit rule by defining a pattern rule
  with the same target and prerequisites, but no commands.  For example,
  the following would cancel the rule that runs the assembler:

       %.o : %.s

(section "Canceling Implicit Rules").

Remove the ";" at the end of your pattern rules above, and everything
should work correctly.

  tt> > make tmp.o
  tt> make: Circular tmp.F <- tmp.f dependency dropped.
  tt> make: `tmp.o' is up to date.

Yes.  That's because make wants to build tmp.o, and it sees that can be
done from a file tmp.F.  Then make tries to see if it can rebuild tmp.F,
and it sees that it can build tmp.F from tmp.f.  Then it tries to build
tmp.f, and sees it can build that from tmp.F ... ouch, infinite
recursion.  So, make bails.

In general, you can't provide make rules that tell it how to build X
from Y and _also_ build Y from X.  That can't work.

 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]