Hello,
I need some clarifications about “10.8 Implicit Rule Search Algorithm.”
If I have the following makefile:

```
foo.o:

%.o: aaa
        @echo $@ 1111

%aa :
        @echo $@ 2222
```
and run "make -Rr -d -f makefile", I see two identical lines: "Trying
pattern rule with stem 'foo'."

```
........
Updating goal targets....
Considering target file 'foo.o'.
 File 'foo.o' does not exist.
 Looking for an implicit rule for 'foo.o'.
 Trying pattern rule with stem 'foo'.
 Trying rule prerequisite 'aaa'.
 Trying pattern rule with stem 'foo'.
 Trying rule prerequisite 'aaa'.
 Looking for a rule with intermediate file 'aaa'.
........
```

Point 5.3 of the search algorithm states:
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 of target T, then we say it ought to exist.)
In my makefile aaa is neither a target nor a prerequisite, so I change it to:


```
foo.o:

%.o: aaa
        @echo $@ 1111

%aa :
        @echo $@ 2222

bbb : aaa
        @echo $@ 3333
```
Now aaa is a prerequisite for the (dangling) target bbb, and the
message “Trying pattern rule with stem 'foo'.” appears only once:

```
........
Updating goal targets....
Considering target file 'foo.o'.
 File 'foo.o' does not exist.
 Looking for an implicit rule for 'foo.o'.
 Trying pattern rule with stem 'foo'.
 Trying rule prerequisite 'aaa'.
 Found an implicit rule for 'foo.o'.
  Considering target file 'aaa'.
........
```

At first glance, everything seems OK. But I don’t understand what
“target T” refers to in point 5.3, since in point 7 we have:
If a filename is mentioned as a target or as an explicit prerequisite
of any target, then it ought to exist.

So, bbb: aaa should be relevant to point 7, not 5.3. Why then did the
second “Trying pattern rule with stem 'foo'.” line disappear?

                                                           Respect.
--
  Dmitry

Reply via email to