bug-make
[Top][All Lists]
Advanced

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

Re: mixed implicit rules problem


From: Paul D. Smith
Subject: Re: mixed implicit rules problem
Date: Wed, 29 Mar 2006 16:37:56 -0500

%% Yaroslav Halchenko <address@hidden> writes:

  yh> > cat  Makefile
  yh> SO=1
  yh> T=2
  yh> VER=$(SO).$(T)

  yh> lib%.so:lib%.so.$(SO)
  yh>         ln -snf $$(basename $<) $@

  yh> lib%.so.$(SO):lib%.so.$(VER)
  yh>         ln -snf $$(basename $<) $@

  yh> a/b/c/lib%.so.1.2: a/b/c/libz%.so
  yh>         cat $< >| $@
        
  yh> > rm a/b/c/* -f
  yh> > /var/tmp/test# echo 1 > a/b/c/libzz.so.1.2
  yh> > /var/tmp/test# make a/b/c/libz.so
  yh> make: *** No rule to make target `a/b/c/libz.so'.  Stop.

  yh> As you can see, make could not figure out full graph of implicit
  yh> rules on how to derive libz.so from libzz.so.1.2.

If you use the -d option make will show you what it's doing.  You are
expecting the implicit rule creation to proceed like this:

    a/b/c/libz.so -> a/b/c/libz.so.1 -> a/b/c/libz.so.1.2 \
        -> a/b/c/libzz.so -> a/b/c/libzz.so.1 -> a/b/c/libzz.so.1.2

However, this cannot work.  See the GNU make Manual, section "Chains of
Implicit Rules" in the chapter "Implicit Rules":

     No single implicit rule can appear more than once in a chain.  This
  means that `make' will not even consider such a ridiculous thing as
  making `foo' from `foo.o.o' by running the linker twice.  This
  constraint has the added benefit of preventing any infinite loop in the
  search for an implicit rule chain.

If you examine the -d output you'll see this in action:

    ...
   Looking for a rule with intermediate file `a/b/c/libzz.so'.
    Avoiding implicit rule recursion.
    Avoiding implicit rule recursion.
    Avoiding implicit rule recursion.
 No implicit rule found for `a/b/c/libz.so'.

-- 
-------------------------------------------------------------------------------
 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]