bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 回复: 回复: Implicit rule for linking multiple object files


From: Martin Dorey
Subject: Re: 回复: 回复: Implicit rule for linking multiple object files
Date: Thu, 11 Aug 2022 18:53:15 +0000

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 <ljhm@qq.com>
Sent: Thursday, August 11, 2022 11:37
To: Martin Dorey <Martin.Dorey@hitachivantara.com>; Philip Guenther <guenther@gmail.com>
Cc: psmith <psmith@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

[Prev in Thread] Current Thread [Next in Thread]