bug-make
[Top][All Lists]
Advanced

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

[bug #30381] Don't avoid implicit rule recursion quite so soon.


From: Reinier Post
Subject: [bug #30381] Don't avoid implicit rule recursion quite so soon.
Date: Mon, 19 Jul 2010 11:24:31 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 FireTorrent/2.0.1 GTB7.1 ( .NET CLR 3.5.30729)

Follow-up Comment #7, bug #30381 (project make):

  Paul,

I don't think it's complicated to describe.  %: %.o and %.o: %.c don't
shorten the search target so they can't be used twice, while %.made: % does. 
All the cases in my own makefiles are of the second type anyway.  This is only
considered after variable expansion, so variables in rules won't complicate
it.  Things will only become complicated if less restrictive criteria are
chosen instead; this can be done using techniques from formal language theory.
 Even that wouldn't necessarily bother the users of make, just the
implementers, but there is something to be said for keeping things simple. 
Performance will only be lost for cases in which a second application of a
rule during a search matches, and a dependency in that rule is shorter than
the target, and that dependency doesn't eventually produce a viable chain; the
overhead resulting from comparing against the targets in the chain thus far
should be negligible.  So it would be relevant to find existing makefiles in
which such second applications already occur.  (This can be done with a
modified make.)

The existing description at
http://www.gnu.org/software/make/manual/make.html#Implicit-Rule-Search doesn't
even mention the restriction that no chain may contain the same rule twice. 
To document it, 6d can be changed as follows:


(6) d. For each prerequisite that does not exist, follow this algorithm
recursively to see if the prerequisite can be made by an implicit rule,
excluding the present rule from the list of rules to consider.


A variant on my proposal:


(6) d. For each prerequisite that does not exist, follow this algorithm
recursively to see if the prerequisite can be made by an implicit rule,
excluding the present rule from the list of rules to consider if and only if
the present target is not shorter than the prerequisite.


Here, comparing the lengths happens on the rule's first application instead
of on later applications.  This can only make a difference if targets and
dependencies may contain different numbers of masks, which is not possible at
present:


sh>  touch bab ba% ; echo '%.foo: %a%; @echo making $@ from $?' | make -f -
b.foo
making b.foo from ba%


(The second % is not interpreted as a mask.)

  Olexiy,

I know I can hack around the issue in this way, but it makes my makefiles
unmaintainable.  As I said, I have lost time writing makefiles in the past
because I wasn't aware of this restriction, and I'm sure others have, too. I
also lose time because I have to work around it with such techniques.  It's
unclear how often such recursion would be used if it were possible.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30381>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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