make question (static pattern rule)

"James" <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization http://groups.google.com
Message-ID <[email protected]>
mk works as expected, but not mk2
Seems like static pattern rule is the difference.
How to make mk2 work similar to mk?

$ cat mk
%.o: ../%.c
        @echo R0 $@ $<

all: aa/bb/obj/x.o aa/bb/obj/y.o

aa/bb/x.c aa/bb/y.c:
        touch $@

$ make -f mk
R0 aa/bb/obj/x.o aa/bb/obj/../x.c
R0 aa/bb/obj/y.o aa/bb/obj/../y.c

$ cat mk2
%.o: ../%.c
        @echo R0 $@ $<

all: aa/bb/obj/x.o aa/bb/obj/y.o

aa/bb/obj/x.o: %.o: ../%.c
        @echo R1 $@ $<

aa/bb/x.c aa/bb/y.c:
        touch $@

$ make -f mk2
make: *** No rule to make target `../aa/bb/obj/x.c', needed by
`aa/bb/obj/x.o'.  Stop.


James
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.