|
From: | Martin Dorey |
Subject: | Re: 回复: Implicit rule for linking multiple object files |
Date: | Thu, 11 Aug 2022 15:13:02 +0000 |
> I want to compile objects in order of the writting
Just because, today, make
happens to pick nearly what you want it to do without being told about your ordering constraint, doesn't mean that you should rely on it continuing to do so. You should teach make about that order. You could contrive a function to $(eval)
your y.o z.o x.o list into a chain of pairwise dependencies:
z.o: y.o
x.o: z.o
Like this:
objs = y.o z.o x.o
space = $(subst :,,: :)
makeDependency = $(eval $(lastword $(1)): $(firstword $(1)))
$(foreach pair,$(filter-out guard@@% %@@guard,$(join guard $(objs),$(addprefix @@,$(objs) guard))),$(call makeDependency,$(subst @@,$(space),$(pair))))
martind@sirius:~/tmp/ljh-2022-08-11$ make -p | grep '[xyz]\.o: [xyz].o'
make: *** No rule to make target 'y.o', needed by 'z.o'. Stop.
z.o: y.o
x.o: z.o
martind@sirius:~/tmp/ljh-2022-08-11$
|
[Prev in Thread] | Current Thread | [Next in Thread] |