2 Star 8 Fork 9

OpenCloudOS/perf-prof

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile.config 5.53 KB
一键复制 编辑 原始数据 按行查看 历史
# Only test the currently used features and
# display them.
FEATURE_TESTS ?= libelf lzma zlib btf-vmlinux cplus-demangle cxa-demangle libtcmalloc rpmalloc libunwind
FEATURE_DISPLAY := $(FEATURE_TESTS) demangle
FEATURE_GROUP_MEMBERS-libunwind = libunwind-x86 libunwind-x86_64 libunwind-arm libunwind-aarch64
FEATURE_GROUP_MEMBERS-demangle = cplus-demangle cxa-demangle
# Python embedding flags
ifndef NO_LIBPYTHON
PYTHON ?= python3
PYTHON_CONFIG ?= $(PYTHON)-config
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG) --includes 2>/dev/null)
PYTHON_EMBED_LDOPTS := $(shell ($(PYTHON_CONFIG) --libs --embed &>/dev/null && $(PYTHON_CONFIG) --libs --embed 2>/dev/null) || $(PYTHON_CONFIG) --libs 2>/dev/null)
PYTHON_EMBED_LDFLAGS := $(shell ($(PYTHON_CONFIG) --ldflags --embed &>/dev/null && $(PYTHON_CONFIG) --ldflags --embed 2>/dev/null) || $(PYTHON_CONFIG) --ldflags 2>/dev/null)
# python-build-standalone support: add rpath and PYTHONHOME when PYTHON= is specified
ifeq ($(origin PYTHON),command line)
PYTHON_HOME ?= $(shell $(PYTHON_CONFIG) --prefix 2>/dev/null)
PYTHON_LIBDIR := $(PYTHON_HOME)/lib
ifneq ($(wildcard $(PYTHON_LIBDIR)/libpython3*.so),)
PYTHON_EMBED_LDFLAGS += -Wl,-rpath,$(PYTHON_LIBDIR)
endif
endif
FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDFLAGS) $(PYTHON_EMBED_LDOPTS)
FEATURE_TESTS += libpython
FEATURE_DISPLAY += libpython
endif
# libunwind feature detection
ifndef NO_LIBUNWIND
ifeq ($(SRCARCH),x86)
ifeq ($(IS_64_BIT),1)
FEATURE_TESTS += libunwind-x86_64
FEATURE_CHECK_LDFLAGS-libunwind := -lunwind -lunwind-x86_64
FEATURE_CHECK_LDFLAGS-libunwind-x86_64 := -lunwind -lunwind-x86_64
else
FEATURE_TESTS += libunwind-x86
FEATURE_CHECK_LDFLAGS-libunwind := -lunwind -lunwind-x86
FEATURE_CHECK_LDFLAGS-libunwind-x86 := -lunwind -lunwind-x86 -lelf
endif
else ifeq ($(SRCARCH),arm64)
FEATURE_TESTS += libunwind-aarch64
FEATURE_CHECK_LDFLAGS-libunwind := -lunwind -lunwind-aarch64
FEATURE_CHECK_LDFLAGS-libunwind-aarch64 := -lunwind -lunwind-aarch64 -lelf
else ifeq ($(SRCARCH),arm)
FEATURE_TESTS += libunwind-arm
FEATURE_CHECK_LDFLAGS-libunwind := -lunwind -lunwind-arm
FEATURE_CHECK_LDFLAGS-libunwind-arm := -lunwind -lunwind-arm
endif
endif
include $(srctree)/build/Makefile.feature
$(shell printf "" > $(OUTPUT).config-detected)
detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected)
detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
detected_override = $(shell echo "override $(1)=y" >> $(OUTPUT).config-detected)
################################
ifeq ($(feature-libelf), 1)
$(call detected,CONFIG_LIBELF)
else
$(error ERROR: No libelf found. Please install libelf-dev, libelf-devel, elfutils-libelf-devel.)
endif
ifeq ($(feature-lzma), 1)
override CFLAGS += -DHAVE_LZMA_SUPPORT
override CXXFLAGS += -DHAVE_LZMA_SUPPORT
$(call detected,CONFIG_LZMA)
else
$(warning No liblzma found, disables MiniDebugInfo decompression, please install xz-devel/liblzma-dev)
endif
ifeq ($(feature-zlib), 1)
$(call detected,CONFIG_ZLIB)
endif
ifeq ($(feature-btf-vmlinux), 1)
override CFLAGS += -DCONFIG_LIBBPF
# Overrides the make command line option
# `make CONFIG_LIBBPF=1`.
$(call detected_override,CONFIG_LIBBPF)
endif
ifeq ($(feature-cplus-demangle), 1)
override CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
override CXXFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
$(call detected,CONFIG_CPLUS_DEMANGLE)
else
ifeq ($(feature-cxa-demangle), 1)
override CFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
override CXXFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
$(call detected,CONFIG_CXX_DEMANGLE)
endif
endif
ifeq ($(feature-libtcmalloc), 1)
override CFLAGS += -DHAVE_LIBTCMALLOC
override CXXFLAGS += -DHAVE_LIBTCMALLOC
$(call detected,CONFIG_LIBTCMALLOC)
else ifeq ($(feature-rpmalloc), 1)
override CFLAGS += -DHAVE_RPMALLOC
override CXXFLAGS += -DHAVE_RPMALLOC
$(call detected,CONFIG_RPMALLOC)
endif
ifndef NO_LIBPYTHON
ifeq ($(feature-libpython), 1)
override CFLAGS += -DHAVE_LIBPYTHON
override CFLAGS += $(PYTHON_EMBED_CCOPTS)
$(call detected,CONFIG_LIBPYTHON)
$(call detected_var,PYTHON_EMBED_LDOPTS)
$(call detected_var,PYTHON_EMBED_LDFLAGS)
ifneq ($(PYTHON_HOME),)
$(call detected_var,PYTHON_HOME)
endif
else
$(warning No libpython found, disables Python profiler, please install python3-devel/python3-dev)
endif
else
$(warning Disabling Python profiler per NO_LIBPYTHON=1)
endif
ifndef NO_LIBUNWIND
ifeq ($(feature-libunwind), 1)
# Determine arch-specific libunwind library
ifeq ($(SRCARCH),x86)
ifeq ($(IS_64_BIT),1)
ifeq ($(feature-libunwind-x86_64), 1)
LIBUNWIND_ARCH := x86_64
endif
else
ifeq ($(feature-libunwind-x86), 1)
LIBUNWIND_ARCH := x86
endif
endif
else ifeq ($(SRCARCH),arm64)
ifeq ($(feature-libunwind-aarch64), 1)
LIBUNWIND_ARCH := aarch64
endif
else ifeq ($(SRCARCH),arm)
ifeq ($(feature-libunwind-arm), 1)
LIBUNWIND_ARCH := arm
endif
endif
ifneq ($(LIBUNWIND_ARCH),)
override CFLAGS += -DHAVE_LIBUNWIND
$(call detected,CONFIG_LIBUNWIND)
$(call detected_var,LIBUNWIND_ARCH)
else
$(warning libunwind found but arch-specific library missing, disables DWARF unwind)
endif
else
$(warning No libunwind found, disables DWARF unwind, please install libunwind-devel/libunwind-dev)
endif
endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/OpenCloudOS/perf-prof.git
git@gitee.com:OpenCloudOS/perf-prof.git
OpenCloudOS
perf-prof
perf-prof
main

搜索帮助