@@ -216,12 +216,6 @@ ifeq ($(call get-executable,$(BISON)),)
216
216
dummy := $(error Error: $(BISON) is missing on this system, please install it)
217
217
endif
218
218
219
- ifeq ($(BUILD_BPF_SKEL),1)
220
- ifeq ($(call get-executable,$(CLANG)),)
221
- dummy := $(error $(CLANG) is missing on this system, please install it to be able to build with BUILD_BPF_SKEL=1)
222
- endif
223
- endif
224
-
225
219
ifneq ($(OUTPUT),)
226
220
ifeq ($(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 371), 1)
227
221
BISON_FILE_PREFIX_MAP := --file-prefix-map=$(OUTPUT)=
@@ -530,6 +524,16 @@ ifdef CORESIGHT
530
524
endif
531
525
endif
532
526
527
+ ifndef NO_ZLIB
528
+ ifeq ($(feature-zlib), 1)
529
+ CFLAGS += -DHAVE_ZLIB_SUPPORT
530
+ EXTLIBS += -lz
531
+ $(call detected,CONFIG_ZLIB)
532
+ else
533
+ NO_ZLIB := 1
534
+ endif
535
+ endif
536
+
533
537
ifndef NO_LIBELF
534
538
CFLAGS += -DHAVE_LIBELF_SUPPORT
535
539
EXTLIBS += -lelf
@@ -571,22 +575,28 @@ ifndef NO_LIBELF
571
575
572
576
ifndef NO_LIBBPF
573
577
ifeq ($(feature-bpf), 1)
574
- CFLAGS += -DHAVE_LIBBPF_SUPPORT
575
- $(call detected,CONFIG_LIBBPF)
576
-
577
578
# detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status
578
579
$(call feature_check,libbpf)
579
580
580
581
ifdef LIBBPF_DYNAMIC
581
582
ifeq ($(feature-libbpf), 1)
582
583
EXTLIBS += -lbpf
584
+ CFLAGS += -DHAVE_LIBBPF_SUPPORT
585
+ $(call detected,CONFIG_LIBBPF)
583
586
$(call detected,CONFIG_LIBBPF_DYNAMIC)
584
587
else
585
588
dummy := $(error Error: No libbpf devel library found or older than v1.0, please install/update libbpf-devel);
586
589
endif
587
590
else
588
- # Libbpf will be built as a static library from tools/lib/bpf.
589
- LIBBPF_STATIC := 1
591
+ ifeq ($(NO_ZLIB), 1)
592
+ dummy := $(warning Warning: Statically building libbpf not possible as zlib is missing)
593
+ NO_LIBBPF := 1
594
+ else
595
+ # Libbpf will be built as a static library from tools/lib/bpf.
596
+ LIBBPF_STATIC := 1
597
+ $(call detected,CONFIG_LIBBPF)
598
+ CFLAGS += -DHAVE_LIBBPF_SUPPORT
599
+ endif
590
600
endif
591
601
endif
592
602
endif # NO_LIBBPF
@@ -663,16 +673,36 @@ ifndef NO_LIBBPF
663
673
endif
664
674
endif
665
675
666
- ifdef BUILD_BPF_SKEL
667
- $(call feature_check,clang-bpf-co-re)
668
- ifeq ($(feature-clang-bpf-co-re), 0)
669
- dummy := $(error Error: clang too old/not installed. Please install recent clang to build with BUILD_BPF_SKEL)
670
- endif
676
+ ifndef BUILD_BPF_SKEL
677
+ # BPF skeletons control a large number of perf features, by default
678
+ # they are enabled.
679
+ BUILD_BPF_SKEL := 1
680
+ endif
681
+
682
+ ifeq ($(BUILD_BPF_SKEL),1)
671
683
ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
672
- dummy := $(error Error: BPF skeleton support requires libbpf)
684
+ dummy := $(warning Warning: Disabled BPF skeletons as libbpf is required)
685
+ BUILD_BPF_SKEL := 0
686
+ else ifeq ($(filter -DHAVE_LIBELF_SUPPORT, $(CFLAGS)),)
687
+ dummy := $(warning Warning: Disabled BPF skeletons as libelf is required by bpftool)
688
+ BUILD_BPF_SKEL := 0
689
+ else ifeq ($(filter -DHAVE_ZLIB_SUPPORT, $(CFLAGS)),)
690
+ dummy := $(warning Warning: Disabled BPF skeletons as zlib is required by bpftool)
691
+ BUILD_BPF_SKEL := 0
692
+ else ifeq ($(call get-executable,$(CLANG)),)
693
+ dummy := $(warning Warning: Disabled BPF skeletons as clang ($(CLANG)) is missing)
694
+ BUILD_BPF_SKEL := 0
695
+ else
696
+ $(call feature_check,clang-bpf-co-re)
697
+ ifeq ($(feature-clang-bpf-co-re), 0)
698
+ dummy := $(warning Warning: Disabled BPF skeletons as clang is too old)
699
+ BUILD_BPF_SKEL := 0
700
+ endif
701
+ endif
702
+ ifeq ($(BUILD_BPF_SKEL),1)
703
+ $(call detected,CONFIG_PERF_BPF_SKEL)
704
+ CFLAGS += -DHAVE_BPF_SKEL
673
705
endif
674
- $(call detected,CONFIG_PERF_BPF_SKEL)
675
- CFLAGS += -DHAVE_BPF_SKEL
676
706
endif
677
707
678
708
ifndef GEN_VMLINUX_H
@@ -946,16 +976,6 @@ ifndef NO_DEMANGLE
946
976
endif
947
977
endif
948
978
949
- ifndef NO_ZLIB
950
- ifeq ($(feature-zlib), 1)
951
- CFLAGS += -DHAVE_ZLIB_SUPPORT
952
- EXTLIBS += -lz
953
- $(call detected,CONFIG_ZLIB)
954
- else
955
- NO_ZLIB := 1
956
- endif
957
- endif
958
-
959
979
ifndef NO_LZMA
960
980
ifeq ($(feature-lzma), 1)
961
981
CFLAGS += -DHAVE_LZMA_SUPPORT
0 commit comments