summaryrefslogtreecommitdiff
path: root/tools/build
diff options
context:
space:
mode:
authorGuilherme Amadio <amadio@gentoo.org>2024-07-17 20:47:36 +0300
committerNamhyung Kim <namhyung@kernel.org>2024-07-17 23:14:35 +0300
commit8f61e98ad51f167de148488b1881de72fec0d563 (patch)
tree4056607e4dd79f33cda90e25926a98c70324328a /tools/build
parent37ac347f87b616525e0fd397cfc9a163328173aa (diff)
downloadlinux-8f61e98ad51f167de148488b1881de72fec0d563.tar.xz
tools: Make pkg-config dependency checks usable by other tools
Other tools, in tools/verification and tools/tracing, make use of libtraceevent and libtracefs as dependencies. This allows setting up the feature check flags for them as well. Signed-off-by: Guilherme Amadio <amadio@gentoo.org> Tested-by: Thorsten Leemhuis <linux@leemhuis.info> Tested-by: Leo Yan <leo.yan@arm.com> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org> Cc: linux-trace-devel@vger.kernel.org Link: https://lore.kernel.org/r/20240717174739.186988-3-amadio@gentoo.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/build')
-rw-r--r--tools/build/Makefile.feature18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 1e2ab148d5db..e1900abd44f6 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -149,6 +149,24 @@ FEATURE_DISPLAY ?= \
#
FEATURE_GROUP_MEMBERS-libbfd = libbfd-liberty libbfd-liberty-z
+#
+# Declare list of feature dependency packages that provide pkg-config files.
+#
+FEATURE_PKG_CONFIG ?= \
+ libtraceevent \
+ libtracefs
+
+feature_pkg_config = $(eval $(feature_pkg_config_code))
+define feature_pkg_config_code
+ FEATURE_CHECK_CFLAGS-$(1) := $(shell $(PKG_CONFIG) --cflags $(1) 2>/dev/null)
+ FEATURE_CHECK_LDFLAGS-$(1) := $(shell $(PKG_CONFIG) --libs $(1) 2>/dev/null)
+endef
+
+# Set FEATURE_CHECK_(C|LD)FLAGS-$(package) for packages using pkg-config.
+ifneq ($(PKG_CONFIG),)
+ $(foreach package,$(FEATURE_PKG_CONFIG),$(call feature_pkg_config,$(package)))
+endif
+
# Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
# If in the future we need per-feature checks/flags for features not
# mentioned in this list we need to refactor this ;-).