@@ -243,7 +243,7 @@ else # force_fixdep
243
243
244
244
LIB_DIR = $(srctree)/tools/lib/api/
245
245
TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
246
- BPF_DIR = $(srctree)/tools/lib/bpf/
246
+ LIBBPF_DIR = $(srctree)/tools/lib/bpf/
247
247
SUBCMD_DIR = $(srctree)/tools/lib/subcmd/
248
248
LIBPERF_DIR = $(srctree)/tools/lib/perf/
249
249
DOC_DIR = $(srctree)/tools/perf/Documentation/
@@ -295,7 +295,6 @@ strip-libs = $(filter-out -l%,$(1))
295
295
ifneq ($(OUTPUT),)
296
296
TE_PATH=$(OUTPUT)
297
297
PLUGINS_PATH=$(OUTPUT)
298
- BPF_PATH=$(OUTPUT)
299
298
SUBCMD_PATH=$(OUTPUT)
300
299
LIBPERF_PATH=$(OUTPUT)
301
300
ifneq ($(subdir),)
307
306
TE_PATH=$(TRACE_EVENT_DIR)
308
307
PLUGINS_PATH=$(TRACE_EVENT_DIR)plugins/
309
308
API_PATH=$(LIB_DIR)
310
- BPF_PATH=$(BPF_DIR)
311
309
SUBCMD_PATH=$(SUBCMD_DIR)
312
310
LIBPERF_PATH=$(LIBPERF_DIR)
313
311
endif
@@ -326,7 +324,14 @@ LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = $(if $(findstring -static,$(LDFLAGS)),,$(DY
326
324
LIBAPI = $(API_PATH)libapi.a
327
325
export LIBAPI
328
326
329
- LIBBPF = $(BPF_PATH)libbpf.a
327
+ ifneq ($(OUTPUT),)
328
+ LIBBPF_OUTPUT = $(abspath $(OUTPUT))/libbpf
329
+ else
330
+ LIBBPF_OUTPUT = $(CURDIR)/libbpf
331
+ endif
332
+ LIBBPF_DESTDIR = $(LIBBPF_OUTPUT)
333
+ LIBBPF_INCLUDE = $(LIBBPF_DESTDIR)/include
334
+ LIBBPF = $(LIBBPF_OUTPUT)/libbpf.a
330
335
331
336
LIBSUBCMD = $(SUBCMD_PATH)libsubcmd.a
332
337
@@ -831,12 +836,14 @@ $(LIBAPI)-clean:
831
836
$(call QUIET_CLEAN, libapi)
832
837
$(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
833
838
834
- $(LIBBPF): FORCE
835
- $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)
839
+ $(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
840
+ $(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \
841
+ O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= \
842
+ $@ install_headers
836
843
837
844
$(LIBBPF)-clean:
838
845
$(call QUIET_CLEAN, libbpf)
839
- $(Q)$(MAKE ) -C $(BPF_DIR) O=$(OUTPUT) clean >/dev/null
846
+ $(Q)$(RM ) -r -- $(LIBBPF_OUTPUT)
840
847
841
848
$(LIBPERF): FORCE
842
849
$(Q)$(MAKE) -C $(LIBPERF_DIR) EXTRA_CFLAGS="$(LIBPERF_CFLAGS)" O=$(OUTPUT) $(OUTPUT)libperf.a
@@ -1036,16 +1043,15 @@ SKELETONS := $(SKEL_OUT)/bpf_prog_profiler.skel.h
1036
1043
SKELETONS += $(SKEL_OUT)/bperf_leader.skel.h $(SKEL_OUT)/bperf_follower.skel.h
1037
1044
SKELETONS += $(SKEL_OUT)/bperf_cgroup.skel.h
1038
1045
1046
+ $(SKEL_TMP_OUT) $(LIBBPF_OUTPUT):
1047
+ $(Q)$(MKDIR) -p $@
1048
+
1039
1049
ifdef BUILD_BPF_SKEL
1040
1050
BPFTOOL := $(SKEL_TMP_OUT)/bootstrap/bpftool
1041
- LIBBPF_SRC := $(abspath ../lib/bpf)
1042
- BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(BPF_PATH) -I$(LIBBPF_SRC)/..
1043
-
1044
- $(SKEL_TMP_OUT):
1045
- $(Q)$(MKDIR) -p $@
1051
+ BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE)
1046
1052
1047
1053
$(BPFTOOL): | $(SKEL_TMP_OUT)
1048
- CFLAGS= $(MAKE) -C ../bpf/bpftool \
1054
+ $(Q) CFLAGS= $(MAKE) -C ../bpf/bpftool \
1049
1055
OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
1050
1056
1051
1057
VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \
0 commit comments