Commit 8f61e98a authored by Guilherme Amadio's avatar Guilherme Amadio Committed by Namhyung Kim

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: default avatarGuilherme Amadio <amadio@gentoo.org>
Tested-by: default avatarThorsten Leemhuis <linux@leemhuis.info>
Tested-by: default avatarLeo Yan <leo.yan@arm.com>
Acked-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
Cc: linux-trace-devel@vger.kernel.org
Link: https://lore.kernel.org/r/20240717174739.186988-3-amadio@gentoo.orgSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 37ac347f
...@@ -149,6 +149,24 @@ FEATURE_DISPLAY ?= \ ...@@ -149,6 +149,24 @@ FEATURE_DISPLAY ?= \
# #
FEATURE_GROUP_MEMBERS-libbfd = libbfd-liberty libbfd-liberty-z 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. # 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 # If in the future we need per-feature checks/flags for features not
# mentioned in this list we need to refactor this ;-). # mentioned in this list we need to refactor this ;-).
......
...@@ -182,20 +182,15 @@ endif ...@@ -182,20 +182,15 @@ endif
FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS) FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS)
FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS) FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS)
# for linking with debug library, run like:
# make DEBUG=1 PKG_CONFIG_PATH=/opt/libtraceevent/(lib|lib64)/pkgconfig
ifneq ($(NO_LIBTRACEEVENT),1) ifneq ($(NO_LIBTRACEEVENT),1)
ifeq ($(call get-executable,$(PKG_CONFIG)),) ifeq ($(call get-executable,$(PKG_CONFIG)),)
$(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it) $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
endif endif
endif endif
# for linking with debug library, run like:
# make DEBUG=1 PKG_CONFIG_PATH=/opt/libtraceevent/(lib|lib64)/pkgconfig
FEATURE_CHECK_CFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --cflags libtraceevent 2>/dev/null)
FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent 2>/dev/null)
FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs 2>/dev/null)
FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs 2>/dev/null)
FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi
# include ARCH specific config # include ARCH specific config
-include $(src-perf)/arch/$(SRCARCH)/Makefile -include $(src-perf)/arch/$(SRCARCH)/Makefile
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment