mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
tools: ynl: Fix out-of-tree build for ynltool
After the blamed commit, running a out-of-tree build for ynltool fails :
# make -C tools/net/ynl/ynltool O=/tmp/o1
make: Entering directory 'tools/net/ynl/ynltool'
make: *** No rule to make target '/tmp/o1/json_writer.o', needed by '/tmp/o1/ynltool'. Stop.
ynltool's Makefile correctly accounts for $(OUTPUT) to get the list of
object files to generate :
OBJS := $(patsubst %.c,$(OUTPUT)%.o,$(SRCS))
but it never actually set $(OUTPUT) before the blamed commit, meaning
that out-of-tree buils of ynltool were always actually in-tree.
Now, the O= parameter is correctly accounted for, and the %o: %c rule fails.
Let's update the %o: %c rule to also use $(OUTPUT), as well as the .d
file expansion so that any header change is taken into account.
Reported-by: Bobby Eshleman <bobbyeshleman@gmail.com>
Closes: https://lore.kernel.org/all/aqCyWQxqKDuQnZYR@devvm29614.prn0.facebook.com/
Fixes: 917f713b4e ("tools: ynl: Allow cross-compiling ynl and associated tools")
Signed-off-by: Maxime Chevallier (Netdev Foundation) <maxime.chevallier@bootlin.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20260911164135.1428140-1-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
7b37f11090
commit
c0bb05f2d1
|
|
@ -23,7 +23,7 @@ OBJS := $(patsubst %.c,$(OUTPUT)%.o,$(SRCS))
|
|||
|
||||
YNLTOOL := $(OUTPUT)ynltool
|
||||
|
||||
include $(wildcard *.d)
|
||||
include $(wildcard $(OUTPUT)*.d)
|
||||
|
||||
all: $(YNLTOOL)
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ $(YNLTOOL): ../libynl.a $(OBJS)
|
|||
$(Q)echo -e "\tLINK $@"
|
||||
$(Q)$(CC) $(CFLAGS) -o $@ $(OBJS) ../libynl.a -lm
|
||||
|
||||
%.o: %.c ../libynl.a
|
||||
$(OUTPUT)%.o: %.c ../libynl.a
|
||||
$(Q)echo -e "\tCC $@"
|
||||
$(Q)$(COMPILE.c) -MMD -c -o $@ $<
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user