summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/ynl.mk
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-06-28 00:32:50 +0000
committerJakub Kicinski <kuba@kernel.org>2024-07-02 18:59:33 -0700
commit07c3cc51a0853986af0fc52d0544b1b67b391ea8 (patch)
tree79e9ad9c5d7d6b20615bd7c36719a96c0e9de179 /tools/testing/selftests/net/ynl.mk
parent4dec64c52e24c2c9a15f81c115f1be5ea35121cb (diff)
downloadlwn-07c3cc51a0853986af0fc52d0544b1b67b391ea8.tar.gz
lwn-07c3cc51a0853986af0fc52d0544b1b67b391ea8.zip
tools: net: package libynl for use in selftests
Support building the C YNL userspace library into one big static file. We can then link selftests against it for easy to use C netlink interface. Signed-off-by: Mina Almasry <almasrymina@google.com> Link: https://patch.msgid.link/20240628003253.1694510-14-almasrymina@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/ynl.mk')
-rw-r--r--tools/testing/selftests/net/ynl.mk21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/ynl.mk b/tools/testing/selftests/net/ynl.mk
new file mode 100644
index 000000000000..59cb26cf3f73
--- /dev/null
+++ b/tools/testing/selftests/net/ynl.mk
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: GPL-2.0
+
+# YNL selftest build snippet
+
+# Inputs:
+#
+# YNL_GENS: families we need in the selftests
+# YNL_PROGS: TEST_PROGS which need YNL (TODO, none exist, yet)
+# YNL_GEN_FILES: TEST_GEN_FILES which need YNL
+
+YNL_OUTPUTS := $(patsubst %,$(OUTPUT)/%,$(YNL_GEN_FILES))
+
+$(YNL_OUTPUTS): $(OUTPUT)/libynl.a
+$(YNL_OUTPUTS): CFLAGS += \
+ -I$(top_srcdir)/usr/include/ $(KHDR_INCLUDES) \
+ -I$(top_srcdir)/tools/net/ynl/lib/ \
+ -I$(top_srcdir)/tools/net/ynl/generated/
+
+$(OUTPUT)/libynl.a:
+ $(Q)$(MAKE) -C $(top_srcdir)/tools/net/ynl GENS="$(YNL_GENS)" libynl.a
+ $(Q)cp $(top_srcdir)/tools/net/ynl/libynl.a $(OUTPUT)/libynl.a