On Sun, Oct 11, 2026 at 4:36 PM Sasha Levin <[email protected]> wrote: > > Add CONFIG_TOOLS_BUILD_PERF. perf is built as it is built standalone, > with optional features enabled when their libraries are installed, and > with -Werror following CONFIG_WERROR. The feature table is left out of > the kernel build log. > > CONFIG_TOOLS_BUILD_PERF_MINIMAL turns every optional feature off > instead, so the result does not depend on the build machine. allmodconfig > and allyesconfig turn it on. > > Assisted-by: LLM > Signed-off-by: Sasha Levin <[email protected]> > --- > tools/Kconfig | 15 +++++++++++++++ > tools/Makefile.kbuild | 19 +++++++++++++++++++ > 2 files changed, 34 insertions(+) > > diff --git a/tools/Kconfig b/tools/Kconfig > index bf0643b39b86e..488f439592150 100644 > --- a/tools/Kconfig > +++ b/tools/Kconfig > @@ -59,6 +59,21 @@ config TOOLS_BUILD_IIO > help > Build tools/iio (lsiio, iio_event_monitor, iio_generic_buffer). > > +config TOOLS_BUILD_PERF > + bool "perf" > + help > + Build tools/perf. As in a standalone perf build, optional > + features are enabled when the libraries they need are installed. > + > +config TOOLS_BUILD_PERF_MINIMAL > + bool "Build perf with all optional features disabled" > + depends on TOOLS_BUILD_PERF > + help > + Turn off every optional perf feature, so that the result does > + not depend on which libraries the build machine has installed. > + allmodconfig and allyesconfig turn this on, which keeps their > + builds the same on every machine. > + > config TOOLS_BUILD_SPI > bool "SPI tools" > help > diff --git a/tools/Makefile.kbuild b/tools/Makefile.kbuild > index 820a2d9a3893b..62fd494253eca 100644 > --- a/tools/Makefile.kbuild > +++ b/tools/Makefile.kbuild > @@ -73,6 +73,25 @@ PHONY += $(tool-targets) > $(tool-targets): tool-%: FORCE > $(call build,$(outdir)/$*,-C $(toolsdir)/$* O=$(outdir)/$* CC='$(call > escsq,$(tools-cc))',,TOOLS_BUILD_$(shell echo $* | tr a-z A-Z)) > > +# perf, without the feature table in the kernel build log > +perf-flags := CC='$(call escsq,$(tools-cc))' FEATURE_DISPLAY= WERROR=$(if > $(CONFIG_WERROR),1,0) > + > +# Every optional feature off, so the result does not depend on which > +# libraries are installed > +perf-flags-$(CONFIG_TOOLS_BUILD_PERF_MINIMAL) += \ > + NO_LIBELF=1 NO_LIBTRACEEVENT=1 NO_JEVENTS=1 NO_LIBPYTHON=1 NO_LIBDW=1 > \ > + NO_LIBBPF=1 BUILD_BPF_SKEL=0 NO_SLANG=1 NO_GTK2=1 NO_AIO=1 \ > + NO_BACKTRACE=1 NO_DEMANGLE=1 NO_LZMA=1 NO_LIBZSTD=1 NO_ZLIB=1 \ > + NO_LIBNUMA=1 NO_LIBUNWIND=1 NO_LIBLLVM=1 NO_CAPSTONE=1 NO_LIBPFM4=1 \ > + NO_SDT=1 NO_JVMTI=1 NO_LIBDEBUGINFOD=1 NO_BABELTRACE2=1 NO_RUST=1 \ > + NO_SHELLCHECK=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1
It seems unfortunate to maintain this list here, we also have a minimal target as a build test here: https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/tests/make?h=perf-tools-next#n123 I wonder we should just add support for a MINIMAL=1 variable in tools/perf/Makefile.config and have that set these other variables. Thanks, Ian > + > +__tools_build: $(if $(CONFIG_TOOLS_BUILD_PERF),perf) > + > +PHONY += perf > +perf: FORCE > + $(call build,$(outdir)/perf,-C $(toolsdir)/perf -f Makefile.perf > O=$(outdir)/perf $(perf-flags) $(perf-flags-y),,TOOLS_BUILD_PERF) > + > PHONY += FORCE > FORCE: > > -- > 2.53.0 >

