Skip to contentSkip to conversation

tools: ynl: build archives with $(AR)

PATCH Applied Greg Thelen 2 participants 2 messages Jun 22 – Jun 25

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: ynl: build archives with $(AR)

Use $(AR) to allow build system to override the archiver tool (e.g., when cross-compiling for a different architecture) by setting the AR environment variable.

GNU Make defaults AR to ar, so this change will not break existing build environments that do not explicitly set AR.

Fixes 07c3cc51a085 ("tools: net: package libynl for use in selftests")
Fixes 86878f14d71a ("tools: ynl: user space helpers")
---
 tools/net/ynl/Makefile           | 2 +-
 tools/net/ynl/generated/Makefile | 2 +-
 tools/net/ynl/lib/Makefile       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
tools/net/ynl/Makefile +1 -1
index d514a48dae27..3cefe4ed96cb 100644
@@ -22,7 +22,7 @@ tests: | lib generated libynl.a
 ynltool: | lib generated libynl.a
 libynl.a: | lib generated
 	@echo -e "\tAR $@"
-	@ar rcs $@ lib/ynl.o generated/*-user.o
+	@$(AR) rcs $@ lib/ynl.o generated/*-user.o
 
 $(SUBDIRS):
 	@if [ -f "$@/Makefile" ] ; then \
tools/net/ynl/generated/Makefile +1 -1
index 86e1e4a959a7..ea4128f612d6 100644
@@ -37,7 +37,7 @@ all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) $(RSTS)
 
 protos.a: $(OBJS)
 	@echo -e "\tAR $@"
-	@ar rcs $@ $(OBJS)
+	@$(AR) rcs $@ $(OBJS)
 
 %-user.h: $(SPECS_DIR)/%.yaml $(TOOL)
 	@echo -e "\tGEN $@"
tools/net/ynl/lib/Makefile +1 -1
index 4b2b98704ff9..9b98c0599600 100644
@@ -15,7 +15,7 @@ all: ynl.a
 
 ynl.a: $(OBJS)
 	@echo -e "\tAR $@"
-	@ar rcs $@ $(OBJS)
+	@$(AR) rcs $@ $(OBJS)
 
 clean:
 	rm -f *.o *.d *~
Signature · 1 line
2.55.0.rc0.738.g0c8ab3ebcc-goog
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 22 Jun 2026 09:16:59 -0700 you wrote:

Use $(AR) to allow build system to override the archiver tool (e.g., when cross-compiling for a different architecture) by setting the AR environment variable.

GNU Make defaults AR to ar, so this change will not break existing build environments that do not explicitly set AR.

[...]

Here is the summary with links:
- tools: ynl: build archives with $(AR)

    https://git.kernel.org/netdev/net/c/8c37e76f960b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html