Order of static pattern rules is significant while IMHO it should not be

Denis Excoffier <[email protected]>
Newsgroups gmane.comp.gnu.make.bugs
Message-ID <[email protected]>
Hello,
Order of static pattern rules is significant while IMHO it should not be.

Observe the following (below): the same rules are written in
reverse order for foo and bar, and the automatic variable $* has not the
same value in the two recipes:

jupiter% cat Makefile
OBJfoo := foo100.z1
OBJbar := bar200.z1
all : ${OBJfoo} ${OBJbar}
# foo100.z0 and bar200.z0 presumably do exist, and *.z1 don't
${OBJfoo} : foo%.z1 : foo%.z0
${OBJfoo} : %.z1 : %.z0
	@echo $* "(foo100 is expected and foo100 is obtained)"
#
# same rules, with reversed order:
${OBJbar} : %.z1 : %.z0
	@echo $* "(bar200 is expected but 200 is obtained instead)"
${OBJbar} : bar%.z1 : bar%.z0
#
jupiter% touch foo100.z0 bar200.z0; rm -f foo100.z1 bar200.z1
jupiter% make
foo100 (foo100 is expected and foo100 is obtained)
200 (bar200 is expected but 200 is obtained instead)
jupiter% make --version | head -1
GNU Make 4.4.1
jupiter%

The output of 'make -p' seems to infer that
'$*' is filled with the last pattern rule encountered,
even if this is not the one with the recipe.

Is it intended behavior?
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.