bug-make
[Top][All Lists]
Advanced

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

?????? ?????? Implicit rule for linking multiple object files


From: ljh
Subject: ?????? ?????? Implicit rule for linking multiple object files
Date: Fri, 12 Aug 2022 02:37:07 +0800

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]