If a target matches multiple pattern rules, make will use the one whose prerequisites exist or can be built. For example:
%.o: %.c $(CC) $(CFLAGS) -c $< -o $@ %.o: %.s $(AS) $(ASFLAGS) $< -o $@
foo.o or assemble
foo.o, depending on which one of
If multiple rules have prerequisites that exist or can be built, make will use the rule that matches to the shortest stem. For example:
f%r: @echo Stem is: $* fo%r: @echo Stem is: $*
Will use the second rule to make the target
Stem is: o.ba.
If multiple rules match to the shortest stem, make will use the first one in the Makefile.