makefile

SECONDEXPANSION and implicit rule recursion don't work


I typed make aaa.zzz after touch a b c. I got nothing. No stdout, no stderr. Why?

GNU Make 3.82

It doesn't work.

.SECONDEXPANSION: 

%.xxx: $$(shell echo a b c)
    echo in xxx

%.zzz: %.xxx $$(shell echo a b)
    echo in zzz

It works. (echo a b to echo a b c)

.SECONDEXPANSION: 

%.xxx: $$(shell echo a b c)
    echo in xxx

%.zzz: %.xxx $$(shell echo a b c)
    echo in zzz

It works. (echo a b c to echo b c)

.SECONDEXPANSION: 

%.xxx: $$(shell echo b c)
    echo in xxx

%.zzz: %.xxx $$(shell echo a b)
    echo in zzz

It works. (echo a b to echo a)

.SECONDEXPANSION: 

%.xxx: $$(shell echo a b c)
    echo in xxx

%.zzz: %.xxx $$(shell echo a)
    echo in zzz

-d says as below.

> make aaa.zzz -d
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
...
Updating goal targets....
Considering target file `aaa.zzz'.
 File `aaa.zzz' does not exist.
 Looking for an implicit rule for `aaa.zzz'.
 Trying pattern rule with stem `aaa'.
 Trying implicit prerequisite `aaa.xxx'.
 Trying pattern rule with stem `aaa.zzz'.
 Trying implicit prerequisite `aaa.zzz,v'.
 Trying pattern rule with stem `aaa.zzz'.
 Trying implicit prerequisite `RCS/aaa.zzz,v'.
 Trying pattern rule with stem `aaa.zzz'.
 Trying implicit prerequisite `RCS/aaa.zzz'.
 Trying pattern rule with stem `aaa.zzz'.
 Trying implicit prerequisite `s.aaa.zzz'.
 Trying pattern rule with stem `aaa.zzz'.
 Trying implicit prerequisite `SCCS/s.aaa.zzz'.
 Trying pattern rule with stem `aaa'.
 Trying implicit prerequisite `aaa.xxx'.
 Looking for a rule with intermediate file `aaa.xxx'.
  Avoiding implicit rule recursion.
  Trying pattern rule with stem `aaa'.
  Trying implicit prerequisite `a'.
  Trying implicit prerequisite `b'.
  Trying implicit prerequisite `c'.
 Trying implicit prerequisite `a'.
 Trying implicit prerequisite `b'.
(END)

Solution

  • This may be a bug in GNU Make 3.82. After I upgraded to GNU Make 4.4, the issue was resolved.