mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v2] tools: ynl: Fix out-of-tree build for ynltool
@ 2026-09-11 16:41 Maxime Chevallier (Netdev Foundation)
  2026-09-11 16:47 ` Nicolai Buchwitz
  2026-09-15  0:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Maxime Chevallier (Netdev Foundation) @ 2026-09-11 16:41 UTC (permalink / raw)
  To: Andrew Lunn, davem, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Bobby Eshleman, Donald Hunter, Simon Horman, Shuah Khan, matttbe,
	Stanislav Fomichev, Nicolai Buchwitz
  Cc: Maxime Chevallier (Netdev Foundation),
	netdev, linux-kernel, thomas.petazzoni, linux-kselftest

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: 917f713b4ec4 ("tools: ynl: Allow cross-compiling ynl and associated tools")
Signed-off-by: Maxime Chevallier (Netdev Foundation) <maxime.chevallier@bootlin.com>
---
V2: Add include $(wildcard $(OUTPUT)*.d), from Nicolai

V1: https://lore.kernel.org/netdev/20260910085931.3c64f2ab@kernel.org/

 tools/net/ynl/ynltool/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/net/ynl/ynltool/Makefile b/tools/net/ynl/ynltool/Makefile
index b8c67cdb4fdf..e79b8af353c3 100644
--- a/tools/net/ynl/ynltool/Makefile
+++ b/tools/net/ynl/ynltool/Makefile
@@ -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 $@ $<
 
-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-15  0:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 16:41 [PATCH net-next v2] tools: ynl: Fix out-of-tree build for ynltool Maxime Chevallier (Netdev Foundation)
2026-09-11 16:47 ` Nicolai Buchwitz
2026-09-15  0:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®