blob: 42985ae2e24abfa53a52f80598c184356df817e5 [file] [log] [blame]
Jiri Olsa8bd407b2013-03-15 16:28:49 +01001
Jiri Olsaa6cf5f32014-01-03 15:32:32 +01002ifeq ($(src-perf),)
3src-perf := $(srctree)/tools/perf
Jiri Olsa8bd407b2013-03-15 16:28:49 +01004endif
5
Jiri Olsaa6cf5f32014-01-03 15:32:32 +01006ifeq ($(obj-perf),)
7obj-perf := $(OUTPUT)
8endif
9
10ifneq ($(obj-perf),)
11obj-perf := $(abspath $(obj-perf))/
12endif
13
Sergei Trofimovich52c0a182015-07-19 10:30:05 +010014$(shell printf "" > $(OUTPUT).config-detected)
Aaro Koskinen642273792015-07-01 14:54:42 +030015detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected)
16detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
Jiri Olsafcfd6612014-12-31 17:37:00 +010017
Jiri Olsaa6cf5f32014-01-03 15:32:32 +010018CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
19
Wang Nan935e6bd2016-01-11 13:47:58 +000020include $(srctree)/tools/scripts/Makefile.arch
Jiri Olsaa6cf5f32014-01-03 15:32:32 +010021
Jiada Wang7a759cd2017-04-09 20:02:37 -070022$(call detected_var,SRCARCH)
Jiri Olsaf39e0422014-12-29 15:03:09 +010023
Jiri Olsaa6cf5f32014-01-03 15:32:32 +010024NO_PERF_REGS := 1
Hendrik Brueckner901bb022017-12-07 09:27:59 +010025NO_SYSCALL_TABLE := 1
Jiri Olsaa6cf5f32014-01-03 15:32:32 +010026
Anju Tdc642e82016-02-20 10:32:47 +053027# Additional ARCH settings for ppc
Jiada Wang7a759cd2017-04-09 20:02:37 -070028ifeq ($(SRCARCH),powerpc)
Anju Tdc642e82016-02-20 10:32:47 +053029 NO_PERF_REGS := 0
Ravi Bangoria4281da22018-01-29 14:04:17 +053030 NO_SYSCALL_TABLE := 0
31 CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated
Chandan Kumarc4522462016-04-28 15:01:09 +053032 LIBUNWIND_LIBS := -lunwind -lunwind-ppc64
Anju Tdc642e82016-02-20 10:32:47 +053033endif
34
Jiri Olsaa6cf5f32014-01-03 15:32:32 +010035# Additional ARCH settings for x86
Jiada Wang7a759cd2017-04-09 20:02:37 -070036ifeq ($(SRCARCH),x86)
Jiri Olsaf39e0422014-12-29 15:03:09 +010037 $(call detected,CONFIG_X86)
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080038 ifeq (${IS_64_BIT}, 1)
Hendrik Brueckner901bb022017-12-07 09:27:59 +010039 NO_SYSCALL_TABLE := 0
40 CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated
Jiri Olsa8e1b3f62013-04-15 04:06:58 +020041 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
Konstantin Khlebnikov60913e02017-08-20 14:39:32 +030042 LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
Jiri Olsa72965b82014-12-29 13:52:36 +010043 $(call detected,CONFIG_X86_64)
Adrian Hunter8a0c4c22013-11-01 15:51:32 +020044 else
Adrian Hunter05b41772015-05-19 16:05:43 +030045 LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind
Jiri Olsa8e1b3f62013-04-15 04:06:58 +020046 endif
47 NO_PERF_REGS := 0
Jiri Olsa8bd407b2013-03-15 16:28:49 +010048endif
Jean Pihet8ab596a2014-04-28 14:32:33 +020049
Jiada Wang7a759cd2017-04-09 20:02:37 -070050ifeq ($(SRCARCH),arm)
Will Deacon7495f372013-09-26 12:36:36 +010051 NO_PERF_REGS := 0
52 LIBUNWIND_LIBS = -lunwind -lunwind-arm
53endif
Jiri Olsa8bd407b2013-03-15 16:28:49 +010054
Jiada Wang7a759cd2017-04-09 20:02:37 -070055ifeq ($(SRCARCH),arm64)
Jean Pihet8ab596a2014-04-28 14:32:33 +020056 NO_PERF_REGS := 0
Kim Phillipsa7f660d2018-07-06 16:34:54 -050057 NO_SYSCALL_TABLE := 0
58 CFLAGS += -I$(OUTPUT)arch/arm64/include/generated
Jean Pihet8ab596a2014-04-28 14:32:33 +020059 LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
60endif
61
Mao Han32134862019-04-15 17:17:30 +080062ifeq ($(SRCARCH),csky)
63 NO_PERF_REGS := 0
64endif
65
Heiko Carstensf704ef42016-01-19 11:23:38 +010066ifeq ($(ARCH),s390)
67 NO_PERF_REGS := 0
Hendrik Brueckner901bb022017-12-07 09:27:59 +010068 NO_SYSCALL_TABLE := 0
Hendrik Bruecknera9a3f1d2017-12-13 17:46:54 -030069 CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated
Heiko Carstensf704ef42016-01-19 11:23:38 +010070endif
71
Jiri Olsa3bc33742014-12-30 13:30:04 +010072ifeq ($(NO_PERF_REGS),0)
73 $(call detected,CONFIG_PERF_REGS)
74endif
75
Hendrik Brueckner901bb022017-12-07 09:27:59 +010076ifneq ($(NO_SYSCALL_TABLE),1)
Jin Yao22e9af42018-04-09 18:26:48 +080077 CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT
Hendrik Brueckner901bb022017-12-07 09:27:59 +010078endif
79
Jean Pihet90fa9de2014-05-16 10:41:11 +020080# So far there's only x86 and arm libdw unwind support merged in perf.
Jiri Olsa4dc549e2014-04-20 10:50:00 +020081# Disable it on all other architectures in case libdw unwind
82# support is detected in system. Add supported architectures
83# to the check.
Mao Han32134862019-04-15 17:17:30 +080084ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky))
Jiri Olsa4dc549e2014-04-20 10:50:00 +020085 NO_LIBDW_DWARF_UNWIND := 1
86endif
87
Jean Pihet1448fef2013-12-10 13:24:04 +010088ifeq ($(LIBUNWIND_LIBS),)
89 NO_LIBUNWIND := 1
Jean Pihet1448fef2013-12-10 13:24:04 +010090endif
Wang Nan5a155bb2016-01-29 05:57:30 +000091#
92# For linking with debug library, run like:
93#
94# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
95#
He Kuang195106b2016-06-03 03:33:10 +000096
97libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code))
98define libunwind_arch_set_flags_code
99 FEATURE_CHECK_CFLAGS-libunwind-$(1) = -I$(LIBUNWIND_DIR)/include
100 FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib
101endef
102
Wang Nan5a155bb2016-01-29 05:57:30 +0000103ifdef LIBUNWIND_DIR
104 LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
105 LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
He Kuang195106b2016-06-03 03:33:10 +0000106 LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64
107 $(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch)))
Wang Nan5a155bb2016-01-29 05:57:30 +0000108endif
Wang Nan5a155bb2016-01-29 05:57:30 +0000109
110# Set per-feature check compilation flags
111FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
He Kuang403cacb2016-06-03 03:33:14 +0000112FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
Wang Nan5a155bb2016-01-29 05:57:30 +0000113FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
He Kuang403cacb2016-06-03 03:33:14 +0000114FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
Jean Pihet1448fef2013-12-10 13:24:04 +0100115
Arnaldo Carvalho de Melo5c4d7c82019-02-12 16:34:32 -0300116FEATURE_CHECK_LDFLAGS-libunwind-arm = -lunwind -lunwind-arm
117FEATURE_CHECK_LDFLAGS-libunwind-aarch64 = -lunwind -lunwind-aarch64
118FEATURE_CHECK_LDFLAGS-libunwind-x86 = -lunwind -llzma -lunwind-x86
119FEATURE_CHECK_LDFLAGS-libunwind-x86_64 = -lunwind -llzma -lunwind-x86_64
120
Arnaldo Carvalho de Melo271402a2019-02-12 16:19:45 -0300121FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto
122
Mathieu Poirieraa6292f2018-01-17 10:52:10 -0700123ifdef CSINCLUDES
124 LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
125endif
126OPENCSDLIBS := -lopencsd_c_api -lopencsd
127ifdef CSLIBS
128 LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
129endif
130FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS)
131FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS)
132
Jiri Olsa8bd407b2013-03-15 16:28:49 +0100133ifeq ($(NO_PERF_REGS),0)
Ingo Molnar89fe8082013-09-30 12:07:11 +0200134 CFLAGS += -DHAVE_PERF_REGS_SUPPORT
Jiri Olsa8bd407b2013-03-15 16:28:49 +0100135endif
Jiri Olsaa32f4932013-03-25 00:32:01 +0100136
Wang Nan5a155bb2016-01-29 05:57:30 +0000137# for linking with debug library, run like:
138# make DEBUG=1 LIBDW_DIR=/opt/libdw/
139ifdef LIBDW_DIR
140 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
141 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
Jiri Olsa45757892014-02-19 16:52:56 +0100142endif
Konstantin Khlebnikovba335df2017-08-20 14:39:27 +0300143DWARFLIBS := -ldw
144ifeq ($(findstring -static,${LDFLAGS}),-static)
145 DWARFLIBS += -lelf -lebl -ldl -lz -llzma -lbz2
146endif
Wang Nan5a155bb2016-01-29 05:57:30 +0000147FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
Konstantin Khlebnikovba335df2017-08-20 14:39:27 +0300148FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
Jiri Olsa45757892014-02-19 16:52:56 +0100149
Wang Nan5a155bb2016-01-29 05:57:30 +0000150# for linking with debug library, run like:
151# make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
152ifdef LIBBABELTRACE_DIR
153 LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include
154 LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
Jiri Olsa53d0a572015-02-20 23:16:58 +0100155endif
Wang Nan5a155bb2016-01-29 05:57:30 +0000156FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
157FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
Jiri Olsa53d0a572015-02-20 23:16:58 +0100158
Jiada Wang7a759cd2017-04-09 20:02:37 -0700159FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi
Jiri Olsa7c537462013-05-24 14:35:23 +0200160# include ARCH specific config
Jiada Wang7a759cd2017-04-09 20:02:37 -0700161-include $(src-perf)/arch/$(SRCARCH)/Makefile
Jiri Olsa7c537462013-05-24 14:35:23 +0200162
Wang Nan63ab0242015-09-14 23:02:49 -0300163ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
164 CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
165endif
166
Arnaldo Carvalho de Meloca70c242016-03-18 13:57:20 -0300167include $(srctree)/tools/scripts/utilities.mak
Jiri Olsaa32f4932013-03-25 00:32:01 +0100168
169ifeq ($(call get-executable,$(FLEX)),)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200170 dummy := $(error Error: $(FLEX) is missing on this system, please install it)
Jiri Olsaa32f4932013-03-25 00:32:01 +0100171endif
172
173ifeq ($(call get-executable,$(BISON)),)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200174 dummy := $(error Error: $(BISON) is missing on this system, please install it)
Jiri Olsaa32f4932013-03-25 00:32:01 +0100175endif
Jiri Olsa362493f2013-03-25 00:40:48 +0100176
177# Treat warnings as errors unless directed not to
178ifneq ($(WERROR),0)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200179 CFLAGS += -Werror
Wang Nand58ac0b2016-11-26 07:03:33 +0000180 CXXFLAGS += -Werror
Jiri Olsa362493f2013-03-25 00:40:48 +0100181endif
182
Adrian Hunter74af3772013-10-22 10:34:05 +0300183ifndef DEBUG
184 DEBUG := 0
185endif
186
Ingo Molnarfcf92582013-10-10 08:05:25 +0200187ifeq ($(DEBUG),0)
David Carrillo-Cisneros38660582017-08-27 00:54:40 -0700188ifeq ($(CC_NO_CLANG), 0)
Arnaldo Carvalho de Melo49b3cd32017-02-14 10:55:27 -0300189 CFLAGS += -O3
190else
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200191 CFLAGS += -O6
Jiri Olsa362493f2013-03-25 00:40:48 +0100192endif
Arnaldo Carvalho de Melo49b3cd32017-02-14 10:55:27 -0300193endif
Jiri Olsa362493f2013-03-25 00:40:48 +0100194
195ifdef PARSER_DEBUG
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200196 PARSER_DEBUG_BISON := -t
197 PARSER_DEBUG_FLEX := -d
198 CFLAGS += -DPARSER_DEBUG
Jiri Olsa9352aab2014-12-29 17:42:46 +0100199 $(call detected_var,PARSER_DEBUG_BISON)
200 $(call detected_var,PARSER_DEBUG_FLEX)
Jiri Olsa362493f2013-03-25 00:40:48 +0100201endif
202
Wang Nan5a155bb2016-01-29 05:57:30 +0000203# Try different combinations to accommodate systems that only have
204# python[2][-config] in weird combinations but always preferring
205# python2 and python2-config as per pep-0394. If we catch a
206# python[-config] in version 3, the version check will kill it.
207PYTHON2 := $(if $(call get-executable,python2),python2,python)
208override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
209PYTHON2_CONFIG := \
210 $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
211override PYTHON_CONFIG := \
212 $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
Namhyung Kim56c7d792014-07-29 15:57:19 +0900213
David Carrillo-Cisneros7be6b312017-04-11 23:49:13 -0700214grep-libs = $(filter -l%,$(1))
215strip-libs = $(filter-out -l%,$(1))
216
Wang Nan5a155bb2016-01-29 05:57:30 +0000217PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
Namhyung Kim56c7d792014-07-29 15:57:19 +0900218
David Carrillo-Cisneros7be6b312017-04-11 23:49:13 -0700219ifdef PYTHON_CONFIG
220 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
221 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
222 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
Jeremy Cline32aa9282018-07-10 11:46:12 -0400223 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
David Carrillo-Cisneros7be6b312017-04-11 23:49:13 -0700224 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
Arnaldo Carvalho de Melo8bd8c652017-02-15 21:31:40 -0300225endif
226
Wang Nan5a155bb2016-01-29 05:57:30 +0000227FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
228FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
229FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
230FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
Namhyung Kim56c7d792014-07-29 15:57:19 +0900231
Arnaldo Carvalho de Meloaa8f9c52019-02-12 11:20:56 -0300232FEATURE_CHECK_LDFLAGS-libaio = -lrt
233
Song Liu8a1b1712019-03-11 22:30:48 -0700234FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes
235
Jiri Olsa2fe73742013-04-15 04:32:28 +0200236CFLAGS += -fno-omit-frame-pointer
237CFLAGS += -ggdb3
238CFLAGS += -funwind-tables
239CFLAGS += -Wall
240CFLAGS += -Wextra
241CFLAGS += -std=gnu99
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100242
Wang Nand58ac0b2016-11-26 07:03:33 +0000243CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti
244CXXFLAGS += -Wall
245CXXFLAGS += -fno-omit-frame-pointer
246CXXFLAGS += -ggdb3
247CXXFLAGS += -funwind-tables
248CXXFLAGS += -Wno-strict-aliasing
249
Mathias Krause6392b4e2014-04-27 18:51:05 +0200250# Enforce a non-executable stack, as we may regress (again) in the future by
251# adding assembler files missing the .GNU-stack linker note.
252LDFLAGS += -Wl,-z,noexecstack
253
Namhyung Kim5e2d4d02014-11-07 14:20:06 +0900254EXTLIBS = -lpthread -lrt -lm -ldl
Jiri Olsa362493f2013-03-25 00:40:48 +0100255
Jiri Olsa96b9e702016-01-15 04:00:18 +0000256ifeq ($(FEATURES_DUMP),)
Jiri Olsae6c76d62015-03-01 21:19:44 +0100257include $(srctree)/tools/build/Makefile.feature
Jiri Olsa96b9e702016-01-15 04:00:18 +0000258else
259include $(FEATURES_DUMP)
260endif
Ingo Molnarbaa9c302013-10-01 14:14:31 +0200261
Ingo Molnar90ac5422013-09-30 13:48:44 +0200262ifeq ($(feature-stackprotector-all), 1)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200263 CFLAGS += -fstack-protector-all
Jiri Olsa362493f2013-03-25 00:40:48 +0100264endif
265
Ingo Molnarfcf92582013-10-10 08:05:25 +0200266ifeq ($(DEBUG),0)
Ingo Molnar1ea6f992013-10-07 09:38:28 +0200267 ifeq ($(feature-fortify-source), 1)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200268 CFLAGS += -D_FORTIFY_SOURCE=2
269 endif
Jiri Olsa362493f2013-03-25 00:40:48 +0100270endif
271
Wang Nane67d52d2016-11-26 07:03:37 +0000272INC_FLAGS += -I$(src-perf)/util/include
Jiada Wang7a759cd2017-04-09 20:02:37 -0700273INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include
Wang Nane67d52d2016-11-26 07:03:37 +0000274INC_FLAGS += -I$(srctree)/tools/include/uapi
275INC_FLAGS += -I$(srctree)/tools/include/
Jiada Wang7a759cd2017-04-09 20:02:37 -0700276INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
277INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
278INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
Jiri Olsa7c537462013-05-24 14:35:23 +0200279
280# $(obj-perf) for generated common-cmds.h
281# $(obj-perf)/util for generated bison/flex headers
282ifneq ($(OUTPUT),)
Wang Nane67d52d2016-11-26 07:03:37 +0000283INC_FLAGS += -I$(obj-perf)/util
284INC_FLAGS += -I$(obj-perf)
Jiri Olsa7c537462013-05-24 14:35:23 +0200285endif
286
Wang Nane67d52d2016-11-26 07:03:37 +0000287INC_FLAGS += -I$(src-perf)/util
288INC_FLAGS += -I$(src-perf)
289INC_FLAGS += -I$(srctree)/tools/lib/
290
291CFLAGS += $(INC_FLAGS)
292CXXFLAGS += $(INC_FLAGS)
Jiri Olsa7c537462013-05-24 14:35:23 +0200293
Jiri Olsa2fe73742013-04-15 04:32:28 +0200294CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
Jiri Olsa362493f2013-03-25 00:40:48 +0100295
Adrian Hunterf6d31362014-07-14 13:02:53 +0300296ifeq ($(feature-sync-compare-and-swap), 1)
297 CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
298endif
299
Vineet Gupta459a3df2015-01-13 19:13:24 +0530300ifeq ($(feature-pthread-attr-setaffinity-np), 1)
301 CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
302endif
303
Arnaldo Carvalho de Melo25ab5ab2017-12-05 10:14:42 -0300304ifeq ($(feature-pthread-barrier), 1)
305 CFLAGS += -DHAVE_PTHREAD_BARRIER
306endif
307
Jiri Olsa4e22db42013-05-24 14:35:24 +0200308ifndef NO_BIONIC
David Ahern5febff02013-10-29 10:43:15 -0600309 $(call feature_check,bionic)
Ingo Molnar78e9d652013-09-30 14:11:46 +0200310 ifeq ($(feature-bionic), 1)
311 BIONIC := 1
Arnaldo Carvalho de Melo748fe082018-12-11 15:48:47 -0300312 CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE
Arnaldo Carvalho de Melod7a8c4a2018-12-11 16:31:19 -0300313 CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE
Ingo Molnar78e9d652013-09-30 14:11:46 +0200314 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
315 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
316 endif
Jiri Olsa362493f2013-03-25 00:40:48 +0100317endif
Jiri Olsacf4cca12013-03-25 00:45:08 +0100318
Arnaldo Carvalho de Melo11c6cbe2018-11-21 17:42:00 -0300319ifeq ($(feature-eventfd), 1)
320 CFLAGS += -DHAVE_EVENTFD
321endif
322
Arnaldo Carvalho de Melo8feb8ef2018-11-19 16:56:22 -0300323ifeq ($(feature-get_current_dir_name), 1)
324 CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
325endif
326
Jiri Olsacf4cca12013-03-25 00:45:08 +0100327ifdef NO_LIBELF
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200328 NO_DWARF := 1
329 NO_DEMANGLE := 1
330 NO_LIBUNWIND := 1
Jiri Olsa5ea84152014-02-19 16:52:57 +0100331 NO_LIBDW_DWARF_UNWIND := 1
Wang Naned63f34c2015-10-14 12:41:12 +0000332 NO_LIBBPF := 1
David Carrillo-Cisnerose5e992a2017-04-12 10:07:45 -0700333 NO_JVMTI := 1
Jiri Olsacf4cca12013-03-25 00:45:08 +0100334else
Ingo Molnar8f7f8002013-09-30 14:20:25 +0200335 ifeq ($(feature-libelf), 0)
Ingo Molnare12762c2013-10-07 10:34:20 +0200336 ifeq ($(feature-glibc), 1)
Ingo Molnar50eed7a2013-09-30 14:11:16 +0200337 LIBC_SUPPORT := 1
338 endif
339 ifeq ($(BIONIC),1)
340 LIBC_SUPPORT := 1
341 endif
342 ifeq ($(LIBC_SUPPORT),1)
David Carrillo-Cisnerose5e992a2017-04-12 10:07:45 -0700343 msg := $(warning No libelf found. Disables 'probe' tool, jvmti and BPF support in 'perf record'. Please install libelf-dev, libelf-devel or elfutils-libelf-devel);
Jiri Olsacf4cca12013-03-25 00:45:08 +0100344
Ingo Molnar50eed7a2013-09-30 14:11:16 +0200345 NO_LIBELF := 1
346 NO_DWARF := 1
347 NO_DEMANGLE := 1
Arnaldo Carvalho de Melo94589552014-03-25 09:35:11 -0300348 NO_LIBUNWIND := 1
349 NO_LIBDW_DWARF_UNWIND := 1
Wang Naned63f34c2015-10-14 12:41:12 +0000350 NO_LIBBPF := 1
David Carrillo-Cisnerose5e992a2017-04-12 10:07:45 -0700351 NO_JVMTI := 1
Ingo Molnar50eed7a2013-09-30 14:11:16 +0200352 else
Arnaldo Carvalho de Melof9ca2d82014-06-05 12:46:04 -0300353 ifneq ($(filter s% -static%,$(LDFLAGS),),)
354 msg := $(error No static glibc found, please install glibc-static);
355 else
356 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
357 endif
Ingo Molnar50eed7a2013-09-30 14:11:16 +0200358 endif
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200359 else
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100360 ifndef NO_LIBDW_DWARF_UNWIND
361 ifneq ($(feature-libdw-dwarf-unwind),1)
362 NO_LIBDW_DWARF_UNWIND := 1
363 msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
364 endif
365 endif
Ingo Molnar8295d4e2013-10-07 10:35:39 +0200366 ifneq ($(feature-dwarf), 1)
David Carrillo-Cisneros2484c4c2017-01-12 13:01:59 -0800367 ifndef NO_DWARF
368 msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
369 NO_DWARF := 1
370 endif
Arnaldo Carvalho de Melobd0419e2016-04-05 11:33:41 -0300371 else
372 ifneq ($(feature-dwarf_getlocations), 1)
373 msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
374 else
Jin Yaoa36ebe42018-03-30 17:27:13 +0800375 CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
Arnaldo Carvalho de Melobd0419e2016-04-05 11:33:41 -0300376 endif # dwarf_getlocations
Ingo Molnar50eed7a2013-09-30 14:11:16 +0200377 endif # Dwarf support
Ingo Molnar0648f832013-10-02 15:30:35 +0200378 endif # libelf support
Jiri Olsacf4cca12013-03-25 00:45:08 +0100379endif # NO_LIBELF
380
Jin Yao8e2c2412018-03-30 17:27:12 +0800381ifeq ($(feature-glibc), 1)
382 CFLAGS += -DHAVE_GLIBC_SUPPORT
383endif
384
Alexey Budankov2a07d812018-11-06 12:03:35 +0300385ifeq ($(feature-libaio), 1)
386 ifndef NO_AIO
387 CFLAGS += -DHAVE_AIO_SUPPORT
388 endif
389endif
390
Naveen N. Rao76d40842015-04-29 16:45:31 +0530391ifdef NO_DWARF
392 NO_LIBDW_DWARF_UNWIND := 1
393endif
394
Arnaldo Carvalho de Melo120010c2017-03-02 12:55:49 -0300395ifeq ($(feature-sched_getcpu), 1)
396 CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
397endif
398
Arnaldo Carvalho de Melo86bcdb52017-07-18 17:15:29 -0300399ifeq ($(feature-setns), 1)
400 CFLAGS += -DHAVE_SETNS_SUPPORT
401 $(call detected,CONFIG_SETNS)
402endif
403
Arnaldo Carvalho de Melo1c3b28f2019-02-12 14:37:15 -0300404ifdef CORESIGHT
405 $(call feature_check,libopencsd)
Mathieu Poirieraa6292f2018-01-17 10:52:10 -0700406 ifeq ($(feature-libopencsd), 1)
407 CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
408 LDFLAGS += $(LIBOPENCSD_LDFLAGS)
409 EXTLIBS += $(OPENCSDLIBS)
410 $(call detected,CONFIG_LIBOPENCSD)
411 ifdef CSTRACE_RAW
412 CFLAGS += -DCS_DEBUG_RAW
413 ifeq (${CSTRACE_RAW}, packed)
414 CFLAGS += -DCS_RAW_PACKED
415 endif
416 endif
417 endif
418endif
419
Jiri Olsacf4cca12013-03-25 00:45:08 +0100420ifndef NO_LIBELF
Ingo Molnarfb3d3332013-10-07 10:05:51 +0200421 CFLAGS += -DHAVE_LIBELF_SUPPORT
Namhyung Kim5e2d4d02014-11-07 14:20:06 +0900422 EXTLIBS += -lelf
Jiri Olsa709e6792014-12-29 23:52:25 +0100423 $(call detected,CONFIG_LIBELF)
Jiri Olsa779724f2013-03-25 00:48:14 +0100424
Ingo Molnar8869b172013-09-30 15:02:28 +0200425 ifeq ($(feature-libelf-mmap), 1)
Ingo Molnarfb3d3332013-10-07 10:05:51 +0200426 CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
427 endif
Jiri Olsa779724f2013-03-25 00:48:14 +0100428
Ingo Molnarb7bcef62013-09-30 14:35:27 +0200429 ifeq ($(feature-libelf-getphdrnum), 1)
Ingo Molnarfb3d3332013-10-07 10:05:51 +0200430 CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
431 endif
Jiri Olsa779724f2013-03-25 00:48:14 +0100432
Arnaldo Carvalho de Melo1c1a3a42016-07-12 12:19:09 -0300433 ifeq ($(feature-libelf-gelf_getnote), 1)
434 CFLAGS += -DHAVE_GELF_GETNOTE_SUPPORT
435 else
436 msg := $(warning gelf_getnote() not found on libelf, SDT support disabled);
437 endif
438
Arnaldo Carvalho de Melo2492c462016-07-04 19:35:47 -0300439 ifeq ($(feature-libelf-getshdrstrndx), 1)
440 CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
441 endif
442
Ingo Molnarfb3d3332013-10-07 10:05:51 +0200443 ifndef NO_DWARF
444 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
Jiada Wang7a759cd2017-04-09 20:02:37 -0700445 msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);
Ingo Molnarfb3d3332013-10-07 10:05:51 +0200446 NO_DWARF := 1
447 else
448 CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
449 LDFLAGS += $(LIBDW_LDFLAGS)
Andi Kleen7aec51c2015-08-12 15:48:37 -0700450 EXTLIBS += ${DWARFLIBS}
Jiri Olsa8379fce2014-12-30 00:06:25 +0100451 $(call detected,CONFIG_DWARF)
Ingo Molnarfb3d3332013-10-07 10:05:51 +0200452 endif # PERF_HAVE_DWARF_REGS
453 endif # NO_DWARF
Wang Naned63f34c2015-10-14 12:41:12 +0000454
455 ifndef NO_LIBBPF
456 ifeq ($(feature-bpf), 1)
457 CFLAGS += -DHAVE_LIBBPF_SUPPORT
458 $(call detected,CONFIG_LIBBPF)
459 endif
Wang Nan1c0ed632015-11-16 12:10:10 +0000460
461 ifndef NO_DWARF
462 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
463 CFLAGS += -DHAVE_BPF_PROLOGUE
464 $(call detected,CONFIG_BPF_PROLOGUE)
465 else
Jiada Wang7a759cd2017-04-09 20:02:37 -0700466 msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset());
Wang Nan1c0ed632015-11-16 12:10:10 +0000467 endif
468 else
469 msg := $(warning DWARF support is off, BPF prologue is disabled);
470 endif
471
Wang Naned63f34c2015-10-14 12:41:12 +0000472 endif # NO_LIBBPF
Jiri Olsacf4cca12013-03-25 00:45:08 +0100473endif # NO_LIBELF
Jiri Olsa0e433fe2013-03-25 00:53:03 +0100474
Masami Hiramatsue26e63b2016-07-12 19:05:56 +0900475ifndef NO_SDT
476 ifneq ($(feature-sdt), 1)
477 msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev);
478 NO_SDT := 1;
479 else
480 CFLAGS += -DHAVE_SDT_EVENT
481 $(call detected,CONFIG_SDT_EVENT)
482 endif
483endif
484
Jiri Olsae12b2022016-03-10 17:41:13 +0100485ifdef PERF_HAVE_JITDUMP
Maciej Debski621cb4e2016-10-13 03:59:36 -0700486 ifndef NO_LIBELF
Jiri Olsae12b2022016-03-10 17:41:13 +0100487 $(call detected,CONFIG_JITDUMP)
488 CFLAGS += -DHAVE_JITDUMP
489 endif
490endif
491
Jiada Wang7a759cd2017-04-09 20:02:37 -0700492ifeq ($(SRCARCH),powerpc)
Anton Blanchard65ccb4f2014-08-25 18:25:06 +1000493 ifndef NO_DWARF
494 CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
495 endif
496endif
497
Jiri Olsa0e433fe2013-03-25 00:53:03 +0100498ifndef NO_LIBUNWIND
He Kuang9d8e14d2016-06-03 03:33:15 +0000499 have_libunwind :=
He Kuang52ffe0f2016-06-03 03:33:22 +0000500
Arnaldo Carvalho de Melo5c4d7c82019-02-12 16:34:32 -0300501 $(call feature_check,libunwind-x86)
He Kuang52ffe0f2016-06-03 03:33:22 +0000502 ifeq ($(feature-libunwind-x86), 1)
503 $(call detected,CONFIG_LIBUNWIND_X86)
504 CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
505 LDFLAGS += -lunwind-x86
He Kuang906a8272016-06-15 11:03:56 +0000506 EXTLIBS_LIBUNWIND += -lunwind-x86
He Kuang52ffe0f2016-06-03 03:33:22 +0000507 have_libunwind = 1
508 endif
509
Arnaldo Carvalho de Melo5c4d7c82019-02-12 16:34:32 -0300510 $(call feature_check,libunwind-aarch64)
He Kuang057fbfb2016-06-03 03:33:23 +0000511 ifeq ($(feature-libunwind-aarch64), 1)
512 $(call detected,CONFIG_LIBUNWIND_AARCH64)
513 CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
514 LDFLAGS += -lunwind-aarch64
He Kuang906a8272016-06-15 11:03:56 +0000515 EXTLIBS_LIBUNWIND += -lunwind-aarch64
He Kuang057fbfb2016-06-03 03:33:23 +0000516 have_libunwind = 1
517 $(call feature_check,libunwind-debug-frame-aarch64)
518 ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
519 msg := $(warning No debug_frame support found in libunwind-aarch64);
520 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
521 endif
522 endif
523
Ingo Molnar058f9522013-09-30 14:45:44 +0200524 ifneq ($(feature-libunwind), 1)
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100525 msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
He Kuang9d8e14d2016-06-03 03:33:15 +0000526 NO_LOCAL_LIBUNWIND := 1
527 else
528 have_libunwind := 1
529 $(call detected,CONFIG_LOCAL_LIBUNWIND)
530 endif
531
532 ifneq ($(have_libunwind), 1)
Ingo Molnar308e1e72013-10-07 10:30:47 +0200533 NO_LIBUNWIND := 1
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100534 endif
He Kuang9d8e14d2016-06-03 03:33:15 +0000535else
536 NO_LOCAL_LIBUNWIND := 1
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100537endif
538
Wang Naned63f34c2015-10-14 12:41:12 +0000539ifndef NO_LIBBPF
540 ifneq ($(feature-bpf), 1)
541 msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
542 NO_LIBBPF := 1
543 endif
544endif
545
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100546dwarf-post-unwind := 1
547dwarf-post-unwind-text := BUG
548
549# setup DWARF post unwinder
550ifdef NO_LIBUNWIND
551 ifdef NO_LIBDW_DWARF_UNWIND
552 msg := $(warning Disabling post unwind, no support found.);
553 dwarf-post-unwind := 0
Linus Torvaldsf47671e2013-11-14 08:51:29 +0900554 else
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100555 dwarf-post-unwind-text := libdw
Jiri Olsab2e45c32014-12-30 00:11:11 +0100556 $(call detected,CONFIG_LIBDW_DWARF_UNWIND)
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100557 endif
558else
559 dwarf-post-unwind-text := libunwind
Jiri Olsab2e45c32014-12-30 00:11:11 +0100560 $(call detected,CONFIG_LIBUNWIND)
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100561 # Enable libunwind support by default.
562 ifndef NO_LIBDW_DWARF_UNWIND
563 NO_LIBDW_DWARF_UNWIND := 1
564 endif
565endif
566
567ifeq ($(dwarf-post-unwind),1)
568 CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
Jiri Olsaf39e0422014-12-29 15:03:09 +0100569 $(call detected,CONFIG_DWARF_UNWIND)
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100570else
571 NO_DWARF_UNWIND := 1
572endif
573
He Kuang9d8e14d2016-06-03 03:33:15 +0000574ifndef NO_LOCAL_LIBUNWIND
Jiada Wang7a759cd2017-04-09 20:02:37 -0700575 ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64))
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100576 $(call feature_check,libunwind-debug-frame)
577 ifneq ($(feature-libunwind-debug-frame), 1)
578 msg := $(warning No debug_frame support found in libunwind);
Linus Torvaldsf47671e2013-11-14 08:51:29 +0900579 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
580 endif
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100581 else
582 # non-ARM has no dwarf_find_debug_frame() function:
583 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
584 endif
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100585 EXTLIBS += $(LIBUNWIND_LIBS)
He Kuang9d8e14d2016-06-03 03:33:15 +0000586 LDFLAGS += $(LIBUNWIND_LIBS)
587endif
Konstantin Khlebnikov60913e02017-08-20 14:39:32 +0300588ifeq ($(findstring -static,${LDFLAGS}),-static)
589 # gcc -static links libgcc_eh which contans piece of libunwind
590 LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition
591endif
He Kuang9d8e14d2016-06-03 03:33:15 +0000592
593ifndef NO_LIBUNWIND
594 CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
Jiri Olsa0a4f2b62014-02-19 16:52:58 +0100595 CFLAGS += $(LIBUNWIND_CFLAGS)
596 LDFLAGS += $(LIBUNWIND_LDFLAGS)
He Kuang906a8272016-06-15 11:03:56 +0000597 EXTLIBS += $(EXTLIBS_LIBUNWIND)
Ingo Molnar058f9522013-09-30 14:45:44 +0200598endif
Jiri Olsaa8279522013-03-25 00:54:36 +0100599
Hendrik Bruecknerb3fa3892018-01-19 09:56:17 +0100600ifeq ($(NO_SYSCALL_TABLE),0)
601 $(call detected,CONFIG_TRACE)
602else
603 ifndef NO_LIBAUDIT
604 ifneq ($(feature-libaudit), 1)
605 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
606 NO_LIBAUDIT := 1
607 else
608 CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
609 EXTLIBS += -laudit
610 $(call detected,CONFIG_TRACE)
611 endif
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200612 endif
Jiri Olsaa8279522013-03-25 00:54:36 +0100613endif
Jiri Olsa4a8f8882013-03-25 00:56:08 +0100614
Stephane Eranian8ee46462015-11-30 10:02:21 +0100615ifndef NO_LIBCRYPTO
616 ifneq ($(feature-libcrypto), 1)
Arnaldo Carvalho de Melo54fceb02018-11-29 20:41:54 -0300617 msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev);
Stephane Eranian8ee46462015-11-30 10:02:21 +0100618 NO_LIBCRYPTO := 1
619 else
620 CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
621 EXTLIBS += -lcrypto
622 $(call detected,CONFIG_CRYPTO)
623 endif
624endif
625
Jiri Olsa4a8f8882013-03-25 00:56:08 +0100626ifdef NO_NEWT
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200627 NO_SLANG=1
Jiri Olsa4a8f8882013-03-25 00:56:08 +0100628endif
629
630ifndef NO_SLANG
Ingo Molnarb9498b52013-09-30 14:57:54 +0200631 ifneq ($(feature-libslang), 1)
Neeraj Badlani9f776ba2016-06-27 06:59:57 -0700632 msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev);
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200633 NO_SLANG := 1
634 else
635 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
636 CFLAGS += -I/usr/include/slang
Ingo Molnar89fe8082013-09-30 12:07:11 +0200637 CFLAGS += -DHAVE_SLANG_SUPPORT
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200638 EXTLIBS += -lslang
Jiri Olsacf15c742014-12-30 00:27:52 +0100639 $(call detected,CONFIG_SLANG)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200640 endif
Jiri Olsa4a8f8882013-03-25 00:56:08 +0100641endif
Jiri Olsa58cabf62013-03-18 00:09:24 +0100642
643ifndef NO_GTK2
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000644 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnar7ef9e052013-09-30 15:01:56 +0200645 ifneq ($(feature-gtk2), 1)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200646 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
647 NO_GTK2 := 1
648 else
Ingo Molnarc7a79e92013-09-30 15:08:30 +0200649 ifeq ($(feature-gtk2-infobar), 1)
Namhyung Kimfc672972013-09-13 15:27:43 +0900650 GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200651 endif
Ingo Molnar89fe8082013-09-30 12:07:11 +0200652 CFLAGS += -DHAVE_GTK2_SUPPORT
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000653 GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
654 GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
Jiri Olsae2137082013-09-26 20:55:54 +0200655 EXTLIBS += -ldl
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200656 endif
Jiri Olsa58cabf62013-03-18 00:09:24 +0100657endif
Jiri Olsa3082cb32013-03-18 00:19:44 +0100658
Jiri Olsa3082cb32013-03-18 00:19:44 +0100659ifdef NO_LIBPERL
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200660 CFLAGS += -DNO_LIBPERL
Jiri Olsa3082cb32013-03-18 00:19:44 +0100661else
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200662 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
663 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
664 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
Jiri Olsa86f5fe02017-11-08 11:27:37 +0100665 PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
Jiri Olsac6707fd2017-12-04 12:23:08 -0300666 PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
667 PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200668 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
Jiri Olsa3082cb32013-03-18 00:19:44 +0100669
Ingo Molnar7181a672013-09-30 15:15:36 +0200670 ifneq ($(feature-libperl), 1)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200671 CFLAGS += -DNO_LIBPERL
672 NO_LIBPERL := 1
Ingo Molnara954e682015-02-28 09:39:09 +0100673 msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev);
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200674 else
675 LDFLAGS += $(PERL_EMBED_LDFLAGS)
676 EXTLIBS += $(PERL_EMBED_LIBADD)
Jin Yao8e2c2412018-03-30 17:27:12 +0800677 CFLAGS += -DHAVE_LIBPERL_SUPPORT
Jiri Olsac7355f82014-12-30 13:11:32 +0100678 $(call detected,CONFIG_LIBPERL)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200679 endif
Jiri Olsa3082cb32013-03-18 00:19:44 +0100680endif
Jiri Olsa6e533cf2013-03-18 00:35:32 +0100681
David Ahern87419c92013-10-29 10:43:16 -0600682ifeq ($(feature-timerfd), 1)
683 CFLAGS += -DHAVE_TIMERFD_SUPPORT
684else
685 msg := $(warning No timerfd support. Disables 'perf kvm stat live');
686endif
687
Jiri Olsa6e533cf2013-03-18 00:35:32 +0100688disable-python = $(eval $(disable-python_code))
689define disable-python_code
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100690 CFLAGS += -DNO_LIBPYTHON
Ingo Molnar6c5aa232015-02-28 09:33:45 +0100691 $(warning $1)
Jiri Olsa6e533cf2013-03-18 00:35:32 +0100692 NO_LIBPYTHON := 1
693endef
694
Namhyung Kim56c7d792014-07-29 15:57:19 +0900695ifdef NO_LIBPYTHON
Ingo Molnar6c5aa232015-02-28 09:33:45 +0100696 $(call disable-python,Python support disabled by user)
Jiri Olsa6e533cf2013-03-18 00:35:32 +0100697else
698
Namhyung Kim56c7d792014-07-29 15:57:19 +0900699 ifndef PYTHON
Ingo Molnar6c5aa232015-02-28 09:33:45 +0100700 $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev)
Jiri Olsa6e533cf2013-03-18 00:35:32 +0100701 else
Namhyung Kim56c7d792014-07-29 15:57:19 +0900702 PYTHON_WORD := $(call shell-wordify,$(PYTHON))
Jiri Olsa6e533cf2013-03-18 00:35:32 +0100703
704 ifndef PYTHON_CONFIG
Ingo Molnar6c5aa232015-02-28 09:33:45 +0100705 $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
Jiri Olsa6e533cf2013-03-18 00:35:32 +0100706 else
707
Ingo Molnar97341632013-09-30 15:18:37 +0200708 ifneq ($(feature-libpython), 1)
Ingo Molnar6c5aa232015-02-28 09:33:45 +0100709 $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
Jiri Olsa6e533cf2013-03-18 00:35:32 +0100710 else
Jaroslav Å karvada66dfdff2018-01-19 21:56:41 +0100711 LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
712 EXTLIBS += $(PYTHON_EMBED_LIBADD)
713 LANG_BINDINGS += $(obj-perf)python/perf.so
Jin Yao8e2c2412018-03-30 17:27:12 +0800714 CFLAGS += -DHAVE_LIBPYTHON_SUPPORT
Jaroslav Å karvada66dfdff2018-01-19 21:56:41 +0100715 $(call detected,CONFIG_LIBPYTHON)
Jiri Olsa6e533cf2013-03-18 00:35:32 +0100716 endif
717 endif
718 endif
719endif
Jiri Olsac3cf8362013-03-18 00:38:16 +0100720
Jiri Olsa3e6a1472013-10-10 22:24:00 +0200721ifeq ($(feature-libbfd), 1)
Song Liu31be9472019-03-11 22:30:47 -0700722 EXTLIBS += -lbfd -lopcodes
Stanislav Fomichev14541b12018-11-15 16:32:01 -0800723else
724 # we are on a system that requires -liberty and (maybe) -lz
725 # to link against -lbfd; test each case individually here
Jiri Olsa2cf90402014-04-23 16:53:25 +0200726
727 # call all detections now so we get correct
728 # status in VF output
Stanislav Fomichev14541b12018-11-15 16:32:01 -0800729 $(call feature_check,libbfd-liberty)
730 $(call feature_check,libbfd-liberty-z)
Jiri Olsa2cf90402014-04-23 16:53:25 +0200731
Stanislav Fomichev14541b12018-11-15 16:32:01 -0800732 ifeq ($(feature-libbfd-liberty), 1)
Song Liu31be9472019-03-11 22:30:47 -0700733 EXTLIBS += -lbfd -lopcodes -liberty
Song Liu8a1b1712019-03-11 22:30:48 -0700734 FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
Jiri Olsa2cf90402014-04-23 16:53:25 +0200735 else
Stanislav Fomichev14541b12018-11-15 16:32:01 -0800736 ifeq ($(feature-libbfd-liberty-z), 1)
Song Liu31be9472019-03-11 22:30:47 -0700737 EXTLIBS += -lbfd -lopcodes -liberty -lz
Song Liu8a1b1712019-03-11 22:30:48 -0700738 FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
Jiri Olsa2cf90402014-04-23 16:53:25 +0200739 endif
740 endif
Song Liu8a1b1712019-03-11 22:30:48 -0700741 $(call feature_check,disassembler-four-args)
Jiri Olsa3e6a1472013-10-10 22:24:00 +0200742endif
743
Jiri Olsac3cf8362013-03-18 00:38:16 +0100744ifdef NO_DEMANGLE
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200745 CFLAGS += -DNO_DEMANGLE
Jiri Olsac3cf8362013-03-18 00:38:16 +0100746else
Ingo Molnar89fe8082013-09-30 12:07:11 +0200747 ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200748 EXTLIBS += -liberty
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200749 else
Stanislav Fomichev14541b12018-11-15 16:32:01 -0800750 ifeq ($(filter -liberty,$(EXTLIBS)),)
751 $(call feature_check,cplus-demangle)
752
753 # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
754 # or any of 'bfd iberty z' trinity
755 ifeq ($(feature-cplus-demangle), 1)
756 EXTLIBS += -liberty
757 else
758 msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
759 CFLAGS += -DNO_DEMANGLE
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200760 endif
761 endif
762 endif
Stanislav Fomichev14541b12018-11-15 16:32:01 -0800763
764 ifneq ($(filter -liberty,$(EXTLIBS)),)
765 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
766 endif
Jiri Olsac3cf8362013-03-18 00:38:16 +0100767endif
Jiri Olsaa1c7c9e2013-03-18 00:41:04 +0100768
Jiri Olsa3e6a1472013-10-10 22:24:00 +0200769ifneq ($(filter -lbfd,$(EXTLIBS)),)
770 CFLAGS += -DHAVE_LIBBFD_SUPPORT
771endif
772
Namhyung Kime92ce122014-10-31 16:51:38 +0900773ifndef NO_ZLIB
774 ifeq ($(feature-zlib), 1)
775 CFLAGS += -DHAVE_ZLIB_SUPPORT
776 EXTLIBS += -lz
Jiri Olsa1571b692014-12-30 13:31:12 +0100777 $(call detected,CONFIG_ZLIB)
Namhyung Kime92ce122014-10-31 16:51:38 +0900778 else
779 NO_ZLIB := 1
780 endif
781endif
782
Jiri Olsa80a32e5b2015-01-29 13:29:39 +0100783ifndef NO_LZMA
784 ifeq ($(feature-lzma), 1)
785 CFLAGS += -DHAVE_LZMA_SUPPORT
786 EXTLIBS += -llzma
787 $(call detected,CONFIG_LZMA)
788 else
789 msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev);
790 NO_LZMA := 1
791 endif
792endif
793
Jiri Olsaa1c7c9e2013-03-18 00:41:04 +0100794ifndef NO_BACKTRACE
Ingo Molnar4cc91172013-09-30 16:49:38 +0200795 ifeq ($(feature-backtrace), 1)
Ingo Molnar89fe8082013-09-30 12:07:11 +0200796 CFLAGS += -DHAVE_BACKTRACE_SUPPORT
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200797 endif
Jiri Olsaa1c7c9e2013-03-18 00:41:04 +0100798endif
Jiri Olsa58a0abd2013-03-18 00:45:27 +0100799
800ifndef NO_LIBNUMA
Ingo Molnar3ae069c2013-09-30 13:37:10 +0200801 ifeq ($(feature-libnuma), 0)
Dongsheng Yang6305edf2013-12-02 10:26:48 -0500802 msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200803 NO_LIBNUMA := 1
804 else
Arnaldo Carvalho de Melof8ac8602015-09-17 12:20:28 -0300805 ifeq ($(feature-numa_num_possible_cpus), 0)
806 msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8);
807 NO_LIBNUMA := 1
808 else
809 CFLAGS += -DHAVE_LIBNUMA_SUPPORT
810 EXTLIBS += -lnuma
811 $(call detected,CONFIG_NUMA)
812 endif
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200813 endif
Jiri Olsa58a0abd2013-03-18 00:45:27 +0100814endif
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100815
Alexander Yaryginda50ad62014-07-03 17:59:49 +0400816ifdef HAVE_KVM_STAT_SUPPORT
817 CFLAGS += -DHAVE_KVM_STAT_SUPPORT
818endif
819
Song Liu8a1b1712019-03-11 22:30:48 -0700820ifeq ($(feature-disassembler-four-args), 1)
821 CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
822endif
823
Adrian Huntere477f3f2014-10-23 18:16:03 -0300824ifeq (${IS_64_BIT}, 1)
825 ifndef NO_PERF_READ_VDSO32
826 $(call feature_check,compile-32)
Adrian Hunter46b1fa82014-10-23 13:45:24 +0300827 ifeq ($(feature-compile-32), 1)
828 CFLAGS += -DHAVE_PERF_READ_VDSO32
829 else
Adrian Huntere477f3f2014-10-23 18:16:03 -0300830 NO_PERF_READ_VDSO32 := 1
831 endif
832 endif
Jiada Wang7a759cd2017-04-09 20:02:37 -0700833 ifneq ($(SRCARCH), x86)
Adrian Huntere477f3f2014-10-23 18:16:03 -0300834 NO_PERF_READ_VDSOX32 := 1
835 endif
836 ifndef NO_PERF_READ_VDSOX32
837 $(call feature_check,compile-x32)
Adrian Hunter46b1fa82014-10-23 13:45:24 +0300838 ifeq ($(feature-compile-x32), 1)
839 CFLAGS += -DHAVE_PERF_READ_VDSOX32
840 else
Adrian Huntere477f3f2014-10-23 18:16:03 -0300841 NO_PERF_READ_VDSOX32 := 1
842 endif
843 endif
844else
845 NO_PERF_READ_VDSO32 := 1
846 NO_PERF_READ_VDSOX32 := 1
847endif
848
Jiri Olsa24787af2018-01-07 17:03:45 +0100849ifndef NO_LIBBABELTRACE
Jiri Olsa97e7a512015-03-11 09:00:41 +0100850 $(call feature_check,libbabeltrace)
851 ifeq ($(feature-libbabeltrace), 1)
Jiri Olsa53d0a572015-02-20 23:16:58 +0100852 CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
853 LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
854 EXTLIBS += -lbabeltrace-ctf
Jiri Olsaedbe9812015-02-20 23:17:00 +0100855 $(call detected,CONFIG_LIBBABELTRACE)
Jiri Olsa97e7a512015-03-11 09:00:41 +0100856 else
857 msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
Jiri Olsa53d0a572015-02-20 23:16:58 +0100858 endif
859endif
860
Adrian Huntere31f0d02015-04-30 17:37:27 +0300861ifndef NO_AUXTRACE
Jiada Wang7a759cd2017-04-09 20:02:37 -0700862 ifeq ($(SRCARCH),x86)
Mathieu Poirier08d52042016-09-16 09:49:58 -0600863 ifeq ($(feature-get_cpuid), 0)
864 msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
865 NO_AUXTRACE := 1
866 endif
867 endif
868 ifndef NO_AUXTRACE
Arnaldo Carvalho de Melob0063db2015-09-17 12:54:30 -0300869 $(call detected,CONFIG_AUXTRACE)
870 CFLAGS += -DHAVE_AUXTRACE_SUPPORT
871 endif
Adrian Huntere31f0d02015-04-30 17:37:27 +0300872endif
873
Jiri Olsad4dfdf02016-11-02 14:35:49 +0100874ifndef NO_JVMTI
875 ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
876 JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
877 else
878 ifneq (,$(wildcard /usr/sbin/alternatives))
Jarod Wilson36b8d462018-09-06 18:18:12 -0400879 JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
Jiri Olsad4dfdf02016-11-02 14:35:49 +0100880 endif
881 endif
882 ifndef JDIR
883 $(warning No alternatives command found, you need to set JDIR= to point to the root of your Java directory)
884 NO_JVMTI := 1
885 endif
886endif
887
888ifndef NO_JVMTI
889 FEATURE_CHECK_CFLAGS-jvmti := -I$(JDIR)/include -I$(JDIR)/include/linux
890 $(call feature_check,jvmti)
891 ifeq ($(feature-jvmti), 1)
892 $(call detected_var,JDIR)
Jiri Olsadd1d0042018-11-21 16:43:41 +0100893 ifndef NO_JVMTI_CMLR
894 FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti)
895 $(call feature_check,jvmti-cmlr)
896 ifeq ($(feature-jvmti-cmlr), 1)
897 CFLAGS += -DHAVE_JVMTI_CMLR
898 endif
899 endif # NO_JVMTI_CMLR
Jiri Olsad4dfdf02016-11-02 14:35:49 +0100900 else
Arnaldo Carvalho de Meloe14b7332018-04-11 12:08:53 -0300901 $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel)
Jiri Olsad4dfdf02016-11-02 14:35:49 +0100902 NO_JVMTI := 1
903 endif
904endif
905
Wang Nand58ac0b2016-11-26 07:03:33 +0000906USE_CXX = 0
907USE_CLANGLLVM = 0
908ifdef LIBCLANGLLVM
909 $(call feature_check,cxx)
910 ifneq ($(feature-cxx), 1)
911 msg := $(warning No g++ found, disable clang and llvm support. Please install g++)
912 else
913 $(call feature_check,llvm)
Wang Nana940cad2016-12-06 07:22:30 +0000914 $(call feature_check,llvm-version)
Wang Nand58ac0b2016-11-26 07:03:33 +0000915 ifneq ($(feature-llvm), 1)
Wang Nana940cad2016-12-06 07:22:30 +0000916 msg := $(warning No suitable libLLVM found, disabling builtin clang and LLVM support. Please install llvm-dev(el) (>= 3.9.0))
Wang Nand58ac0b2016-11-26 07:03:33 +0000917 else
918 $(call feature_check,clang)
919 ifneq ($(feature-clang), 1)
Wang Nana940cad2016-12-06 07:22:30 +0000920 msg := $(warning No suitable libclang found, disabling builtin clang and LLVM support. Please install libclang-dev(el) (>= 3.9.0))
Wang Nand58ac0b2016-11-26 07:03:33 +0000921 else
922 CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT
923 CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir)
924 $(call detected,CONFIG_CXX)
925 $(call detected,CONFIG_CLANGLLVM)
926 USE_CXX = 1
927 USE_LLVM = 1
928 USE_CLANG = 1
Wang Nana940cad2016-12-06 07:22:30 +0000929 ifneq ($(feature-llvm-version),1)
930 msg := $(warning This version of LLVM is not tested. May cause build errors)
931 endif
Wang Nand58ac0b2016-11-26 07:03:33 +0000932 endif
933 endif
934 endif
935endif
936
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100937# Among the variables below, these:
938# perfexecdir
Arnaldo Carvalho de Melo1b16fff2018-05-04 10:37:27 -0300939# perf_include_dir
Arnaldo Carvalho de Melo8f12a2f2018-05-04 11:56:15 -0300940# perf_examples_dir
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100941# template_dir
942# mandir
943# infodir
944# htmldir
945# ETC_PERFCONFIG (but not sysconfdir)
946# can be specified as a relative path some/where/else;
947# this is interpreted as relative to $(prefix) and "perf" at
948# runtime figures out where they are based on the path to the executable.
949# This can help installing the suite in a relocatable way.
950
951# Make the path relative to DESTDIR, not to prefix
952ifndef DESTDIR
Jianyu Zhanfc9cabe2014-06-03 00:44:34 +0800953prefix ?= $(HOME)
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100954endif
955bindir_relative = bin
Pawel Moll0927bee2015-07-28 15:10:13 +0100956bindir = $(abspath $(prefix)/$(bindir_relative))
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100957mandir = share/man
958infodir = share/info
959perfexecdir = libexec/perf-core
Thomas Richter83868bf2018-07-31 09:32:54 +0200960perf_include_dir = lib/perf/include
961perf_examples_dir = lib/perf/examples
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100962sharedir = $(prefix)/share
963template_dir = share/perf-core/templates
Arnaldo Carvalho de Melo005438a82015-07-20 12:02:09 -0300964STRACE_GROUPS_DIR = share/perf-core/strace/groups
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100965htmldir = share/doc/perf-doc
Namhyung Kim14cbfbe2016-01-07 20:41:53 +0900966tipdir = share/doc/perf-tip
Namhyung Kim84cfac72016-01-09 19:16:28 +0900967srcdir = $(srctree)/tools/perf
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100968ifeq ($(prefix),/usr)
969sysconfdir = /etc
970ETC_PERFCONFIG = $(sysconfdir)/perfconfig
971else
972sysconfdir = $(prefix)/etc
973ETC_PERFCONFIG = etc/perfconfig
974endif
Jiri Olsa6997af722014-08-25 16:55:52 +0200975ifndef lib
Jiada Wang7a759cd2017-04-09 20:02:37 -0700976ifeq ($(SRCARCH)$(IS_64_BIT), x861)
Namhyung Kimfc672972013-09-13 15:27:43 +0900977lib = lib64
978else
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100979lib = lib
Namhyung Kimfc672972013-09-13 15:27:43 +0900980endif
Jiri Olsa6997af722014-08-25 16:55:52 +0200981endif # lib
Namhyung Kimfc672972013-09-13 15:27:43 +0900982libdir = $(prefix)/$(lib)
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100983
984# Shell quote (do not use $(call) to accommodate ancient setups);
985ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
Arnaldo Carvalho de Melo005438a82015-07-20 12:02:09 -0300986STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR))
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100987DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
988bindir_SQ = $(subst ','\'',$(bindir))
989mandir_SQ = $(subst ','\'',$(mandir))
990infodir_SQ = $(subst ','\'',$(infodir))
991perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
Arnaldo Carvalho de Melo1b16fff2018-05-04 10:37:27 -0300992perf_include_dir_SQ = $(subst ','\'',$(perf_include_dir))
Arnaldo Carvalho de Melo8f12a2f2018-05-04 11:56:15 -0300993perf_examples_dir_SQ = $(subst ','\'',$(perf_examples_dir))
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100994template_dir_SQ = $(subst ','\'',$(template_dir))
995htmldir_SQ = $(subst ','\'',$(htmldir))
Namhyung Kim14cbfbe2016-01-07 20:41:53 +0900996tipdir_SQ = $(subst ','\'',$(tipdir))
Jiri Olsacd1c39f2013-03-18 00:56:01 +0100997prefix_SQ = $(subst ','\'',$(prefix))
998sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
Namhyung Kimfc672972013-09-13 15:27:43 +0900999libdir_SQ = $(subst ','\'',$(libdir))
Namhyung Kim84cfac72016-01-09 19:16:28 +09001000srcdir_SQ = $(subst ','\'',$(srcdir))
Jiri Olsacd1c39f2013-03-18 00:56:01 +01001001
1002ifneq ($(filter /%,$(firstword $(perfexecdir))),)
1003perfexec_instdir = $(perfexecdir)
Arnaldo Carvalho de Melo1b16fff2018-05-04 10:37:27 -03001004perf_include_instdir = $(perf_include_dir)
Arnaldo Carvalho de Melo8f12a2f2018-05-04 11:56:15 -03001005perf_examples_instdir = $(perf_examples_dir)
Arnaldo Carvalho de Melo005438a82015-07-20 12:02:09 -03001006STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR)
Namhyung Kim14cbfbe2016-01-07 20:41:53 +09001007tip_instdir = $(tipdir)
Jiri Olsacd1c39f2013-03-18 00:56:01 +01001008else
1009perfexec_instdir = $(prefix)/$(perfexecdir)
Arnaldo Carvalho de Melo1b16fff2018-05-04 10:37:27 -03001010perf_include_instdir = $(prefix)/$(perf_include_dir)
Arnaldo Carvalho de Melo8f12a2f2018-05-04 11:56:15 -03001011perf_examples_instdir = $(prefix)/$(perf_examples_dir)
Arnaldo Carvalho de Melo005438a82015-07-20 12:02:09 -03001012STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR)
Namhyung Kim14cbfbe2016-01-07 20:41:53 +09001013tip_instdir = $(prefix)/$(tipdir)
Jiri Olsacd1c39f2013-03-18 00:56:01 +01001014endif
1015perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
Arnaldo Carvalho de Melo1b16fff2018-05-04 10:37:27 -03001016perf_include_instdir_SQ = $(subst ','\'',$(perf_include_instdir))
Arnaldo Carvalho de Melo8f12a2f2018-05-04 11:56:15 -03001017perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir))
Arnaldo Carvalho de Melo005438a82015-07-20 12:02:09 -03001018STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR))
Namhyung Kim14cbfbe2016-01-07 20:41:53 +09001019tip_instdir_SQ = $(subst ','\'',$(tip_instdir))
Jiri Olsa3d7c0142013-12-03 14:09:21 +01001020
1021# If we install to $(HOME) we keep the traceevent default:
1022# $(HOME)/.traceevent/plugins
1023# Otherwise we install plugins into the global $(libdir).
1024ifdef DESTDIR
1025plugindir=$(libdir)/traceevent/plugins
Josh Boyerb935a582014-01-22 10:01:48 -05001026plugindir_SQ= $(subst ','\'',$(plugindir))
Jiri Olsa3d7c0142013-12-03 14:09:21 +01001027endif
Jiri Olsa0695e572014-02-19 16:52:54 +01001028
Jiri Olsa4b20d682015-03-02 13:30:30 +01001029print_var = $(eval $(print_var_code)) $(info $(MSG))
1030define print_var_code
Jiri Olsa8d790762014-02-19 16:52:55 +01001031 MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
1032endef
1033
Jiri Olsa0695e572014-02-19 16:52:54 +01001034ifeq ($(VF),1)
Jiri Olsa99402e02018-01-09 10:26:46 +01001035 # Display EXTRA features which are detected manualy
1036 # from here with feature_check call and thus cannot
1037 # be partof global state output.
1038 $(foreach feat,$(FEATURE_TESTS_EXTRA),$(call feature_print_status,$(feat),))
Jiri Olsa4b20d682015-03-02 13:30:30 +01001039 $(call print_var,prefix)
1040 $(call print_var,bindir)
1041 $(call print_var,libdir)
1042 $(call print_var,sysconfdir)
1043 $(call print_var,LIBUNWIND_DIR)
1044 $(call print_var,LIBDW_DIR)
Jiri Olsad4dfdf02016-11-02 14:35:49 +01001045 $(call print_var,JDIR)
Jiri Olsa76ee2ff2015-12-23 18:58:31 +01001046
1047 ifeq ($(dwarf-post-unwind),1)
1048 $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
1049 endif
Jiri Olsa0695e572014-02-19 16:52:54 +01001050 $(info )
1051endif
Jiri Olsaf39e0422014-12-29 15:03:09 +01001052
1053$(call detected_var,bindir_SQ)
1054$(call detected_var,PYTHON_WORD)
1055ifneq ($(OUTPUT),)
1056$(call detected_var,OUTPUT)
1057endif
Jiri Olsa285ab8b2014-12-29 15:13:44 +01001058$(call detected_var,htmldir_SQ)
1059$(call detected_var,infodir_SQ)
1060$(call detected_var,mandir_SQ)
Jiri Olsa9352aab2014-12-29 17:42:46 +01001061$(call detected_var,ETC_PERFCONFIG_SQ)
Arnaldo Carvalho de Melo005438a82015-07-20 12:02:09 -03001062$(call detected_var,STRACE_GROUPS_DIR_SQ)
Jiri Olsa9352aab2014-12-29 17:42:46 +01001063$(call detected_var,prefix_SQ)
1064$(call detected_var,perfexecdir_SQ)
Arnaldo Carvalho de Melo1b16fff2018-05-04 10:37:27 -03001065$(call detected_var,perf_include_dir_SQ)
Arnaldo Carvalho de Melo8f12a2f2018-05-04 11:56:15 -03001066$(call detected_var,perf_examples_dir_SQ)
Namhyung Kim14cbfbe2016-01-07 20:41:53 +09001067$(call detected_var,tipdir_SQ)
Namhyung Kim84cfac72016-01-09 19:16:28 +09001068$(call detected_var,srcdir_SQ)
Jiri Olsa3b939a62014-12-30 00:16:01 +01001069$(call detected_var,LIBDIR)
Jiri Olsa88aeea02014-12-30 00:34:23 +01001070$(call detected_var,GTK_CFLAGS)
Jiri Olsac7355f82014-12-30 13:11:32 +01001071$(call detected_var,PERL_EMBED_CCOPTS)
1072$(call detected_var,PYTHON_EMBED_CCOPTS)