Hmm, I don't read that as acting like a double-colon rule. Instead, GNU Make does this:
1. You asked for a.o and b.o. 2. The Makefile has a rule that makes %.o from %.c, and one that makes %.o from %.d 3. GNU Make looks for a.c and finds it, then uses recipe #1 for a.o. 4. GNU Make looks for b.c and doesn't find it. 5. GNU Make looks for b.d and finds it, then uses recipe #2 for b.o. A double-colon rule would execute both recipes for each target, which this example clearly doesn't do. -Nick On Sun, Jan 17, 2021 at 7:10 PM Fangrui Song <i...@maskray.me> wrote: > % cat Makefile > .SUFFIXES: > %.o: %.c > touch $@ > %.o: %.d > touch $@ > > > % rm -f a.o b.o; touch a.c b.d; make a.o b.o > removed 'a.o' > removed 'b.o' > touch a.o > touch b.o > > > The behavior is similar to double-colon rules. It can not be explained > by > > > If more than one rule gives a recipe for the same file, make uses the > > last one given and prints an error message. > > in > https://www.gnu.org/software/make/manual/html_node/Multiple-Rules.html#Multiple-Rules > > > Context: I intend to use such multiple rules for one %.o target in an > lldb Makefile https://reviews.llvm.org/D94890 > >
