> Aren't the order of compiling object files of first two rules certain?

No, it's unspecified.  Earlier in this thread, you wrote:

>> The manual states that the x.c compiles first.

The example you're looking at just teaches that compiling x.c first is allowed. 
 It doesn't teach that x.c will always be compiled first.

> Will GNU Make keep their ordering behavior or are they just some random 
> ordering caused by some random bugs

You care about the order but haven't told make that, so the bug is in your 
makefile, not GNU Make.

________________________________
From: ljh <l...@qq.com>
Sent: Thursday, August 11, 2022 11:37
To: Martin Dorey <martin.do...@hitachivantara.com>; Philip Guenther 
<guent...@gmail.com>
Cc: psmith <psm...@gnu.org>; bug-make <bug-make@gnu.org>
Subject: 回复: 回复: Implicit rule for linking multiple object files

***** EXTERNAL EMAIL *****
Thanks Martin,

Your Makefile is too advanced for me to understand by now.

I tested out the below five rules.
Aren't the order of compiling object files of first two rules certain?
Will GNU Make keep their ordering behavior or are they just some random ordering
caused by some random bugs (sorry, no offensive, I love GNU Make)

# ok: in order of writing, with recipe
x: y.o z.o x.o
    $(CC) $^ -o $@

# ok: compiles x.o last, no mentioning x.o
x: y.o z.o


The rest of the below three rules are not suitable if compiling order matters.

# compiles x.o first, mentioning x.o
x: y.o z.o x.o

# compiles x.o first
x: $(patsubst %.y,%.o,$(wildcard *.y))

# in order of file names, with recipe
x: $(patsubst %.y,%.o,$(wildcard *.y))
    $(CC) $^ -o $@

Reply via email to