Re: [PATCH v2 1/2] perf: support build BPF skeletons with perf

From: Jiri Olsa
Date: Mon Dec 07 2020 - 15:26:57 EST


On Thu, Dec 03, 2020 at 10:13:09PM -0800, Song Liu wrote:

SNIP

> @@ -735,7 +739,8 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc
> $(x86_arch_prctl_code_array) \
> $(rename_flags_array) \
> $(arch_errno_name_array) \
> - $(sync_file_range_arrays)
> + $(sync_file_range_arrays) \
> + bpf-skel
>
> $(OUTPUT)%.o: %.c prepare FORCE
> $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
> @@ -1008,7 +1013,42 @@ config-clean:
> python-clean:
> $(python-clean)
>
> -clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBPERF)-clean config-clean fixdep-clean python-clean
> +SKEL_OUT := $(abspath $(OUTPUT)util/bpf_skel)
> +SKEL_TMP_OUT := $(abspath $(SKEL_OUT)/.tmp)
> +SKELETONS :=
> +
> +ifdef BUILD_BPF_SKEL
> +BPFTOOL := $(SKEL_TMP_OUT)/bpftool-bootstrap
> +LIBBPF_SRC := $(abspath ../lib/bpf)
> +BPF_INCLUDE := -I$(SKEL_TMP_OUT)/..

it looks good, but I still need to add following includes to compile
for bpf_helper* headers

jirka


---
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index fb7de412152b..1f2fe339be85 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -1020,7 +1020,7 @@ SKELETONS := $(SKEL_OUT)/bpf_prog_profiler.skel.h
ifdef BUILD_BPF_SKEL
BPFTOOL := $(SKEL_TMP_OUT)/bpftool-bootstrap
LIBBPF_SRC := $(abspath ../lib/bpf)
-BPF_INCLUDE := -I$(SKEL_TMP_OUT)/..
+BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(BPF_PATH) -I$(LIBBPF_SRC)/..

$(SKEL_TMP_OUT):
$(Q)$(MKDIR) -p $@