From 8f61e98ad51f167de148488b1881de72fec0d563 Mon Sep 17 00:00:00 2001 From: Guilherme Amadio Date: Wed, 17 Jul 2024 19:47:36 +0200 Subject: 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 Tested-by: Thorsten Leemhuis Tested-by: Leo Yan Acked-by: Steven Rostedt (Google) Cc: linux-trace-devel@vger.kernel.org Link: https://lore.kernel.org/r/20240717174739.186988-3-amadio@gentoo.org Signed-off-by: Namhyung Kim --- tools/build/Makefile.feature | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tools/build') 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 ;-). -- cgit v1.2.3