Re: [PATCH net-next v3 1/2] tools: ynl: Allow cross-compiling ynl and associated tools
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: 2026-09-09 07:02:08
Hi, On 9/9/26 03:11, Bobby Eshleman wrote:
On Mon, Sep 07, 2026 at 06:14:35PM +0200, Maxime Chevallier (Netdev Foundation) wrote:quoted
The ynl tool and libraries may be built standalone or through the drivers/net/hw selftest machinery. This may target a different arch, so we need to take the CROSS_COMPILE variable into account for LLVM and gcc. Let's include the tools/scripts/Makefile.include that deals with the CC/AR resolution. Fixup the ynltool CFLAGS handling to use +=, so that we don't override the ones set in Makefile.include. Makefile.include also sets the Q variable for verbose mode, so we can drop it from the ynltool Makefile. This will allow properly selection the verbosity of ynltool builds with the V=1 make flag. Reviewed-by: Matthieu Baerts (Netdev Foundation) <matttbe@kernel.org> Signed-off-by: Maxime Chevallier (Netdev Foundation) <maxime.chevallier@bootlin.com>Hey Maxime, It seems that this patch may break some invocations of make: # make -C tools/net/ynl/ynltool O=/tmp/o1 make: Entering directory '/data/users/bobbyeshleman/linux-worktrees/review/tools/net/ynl/ynltool' make: *** No rule to make target '/tmp/o1/json_writer.o', needed by '/tmp/o1/ynltool'. Stop. make: Leaving directory '/data/users/bobbyeshleman/linux-worktrees/review/tools/net/ynl/ynltool'
Indeed, but looks like the command you're mentionning never worked as expected in the first place, passing O=/tmp/xxx triggers the bug, but before the patch, O=/tmp/xxx just does nothing, out-of-tree build just never worked for ynltool : Before this patch : $ make -C tools/net/ynl/ynltool O=/tmp/o1 V=1 make: Entering directory '/home/mchevallier/work/netdev/linux/tools/net/ynl/ynltool' CC json_writer.o CC main.o CC page-pool.o CC qstats.o LINK ynltool make: Leaving directory '/home/mchevallier/work/netdev/linux/tools/net/ynl/ynltool' $ ls /tmp/o1/ $ The fix is simple though: -%.o: %.c ../libynl.a +$(OUTPUT)%.o: %.c ../libynl.a I'll send the followup rightaway. Side-note, out-of-tree build doesn't work for other ynl tools and utilities, but at least trying to do so doesn't error-out. Thanks for the report, Maxime