[RFC PATCH v2 08/26] perf bpf: Add UBPF flags and makefile options

From: He Kuang
Date: Sun Jun 26 2016 - 07:23:57 EST


From: Wang Nan <wangnan0@xxxxxxxxxx>

UBPF are not built by default, unless user explicitly build perf with
UBPF defined.

Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
Signed-off-by: He Kuang <hekuang@xxxxxxxxxx>
---
tools/lib/bpf/Makefile | 4 ++++
tools/perf/Makefile.perf | 2 ++
tools/perf/config/Makefile | 4 ++++
3 files changed, 10 insertions(+)

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index fc1bc75..1fb098d 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -120,6 +120,10 @@ ifeq ($(feature-libelf-getphdrnum), 1)
override CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
endif

+ifdef UBPF
+ override CFLAGS += -DHAVE_UBPF_SUPPORT
+endif
+
# Append required CFLAGS
override CFLAGS += $(EXTRA_WARNINGS)
override CFLAGS += -Werror -Wall
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index d0a2cb1..114a719 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -81,6 +81,8 @@ include ../scripts/utilities.mak
#
# Define NO_LIBBPF if you do not want BPF support
#
+# Define UBPF if you DO want user space BPF support
+#
# Define FEATURES_DUMP to provide features detection dump file
# and bypass the feature detection

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 534c811..2a64534 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -329,6 +329,10 @@ ifndef NO_LIBELF
ifeq ($(feature-bpf), 1)
CFLAGS += -DHAVE_LIBBPF_SUPPORT
$(call detected,CONFIG_LIBBPF)
+ ifdef UBPF
+ CFLAGS += -DHAVE_UBPF_SUPPORT
+ $(call detected,CONFIG_UBPF)
+ endif
endif

ifndef NO_DWARF
--
1.8.5.2