~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/Makefile.config

Version: ~ [ linux-6.1-rc7 ] ~ [ linux-6.0.10 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.80 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.156 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.225 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.267 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.300 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.334 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 # SPDX-License-Identifier: GPL-2.0-only
  2 
  3 ifeq ($(src-perf),)
  4 src-perf := $(srctree)/tools/perf
  5 endif
  6 
  7 ifeq ($(obj-perf),)
  8 obj-perf := $(OUTPUT)
  9 endif
 10 
 11 ifneq ($(obj-perf),)
 12 obj-perf := $(abspath $(obj-perf))/
 13 endif
 14 
 15 $(shell printf "" > $(OUTPUT).config-detected)
 16 detected     = $(shell echo "$(1)=y"       >> $(OUTPUT).config-detected)
 17 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
 18 
 19 CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
 20 
 21 include $(srctree)/tools/scripts/Makefile.arch
 22 
 23 $(call detected_var,SRCARCH)
 24 
 25 NO_PERF_REGS := 1
 26 NO_SYSCALL_TABLE := 1
 27 
 28 # Additional ARCH settings for ppc
 29 ifeq ($(SRCARCH),powerpc)
 30   NO_PERF_REGS := 0
 31   NO_SYSCALL_TABLE := 0
 32   CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated
 33   LIBUNWIND_LIBS := -lunwind -lunwind-ppc64
 34 endif
 35 
 36 # Additional ARCH settings for x86
 37 ifeq ($(SRCARCH),x86)
 38   $(call detected,CONFIG_X86)
 39   ifeq (${IS_64_BIT}, 1)
 40     NO_SYSCALL_TABLE := 0
 41     CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated
 42     ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
 43     LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
 44     $(call detected,CONFIG_X86_64)
 45   else
 46     LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind
 47   endif
 48   NO_PERF_REGS := 0
 49 endif
 50 
 51 ifeq ($(SRCARCH),arm)
 52   NO_PERF_REGS := 0
 53   LIBUNWIND_LIBS = -lunwind -lunwind-arm
 54 endif
 55 
 56 ifeq ($(SRCARCH),arm64)
 57   NO_PERF_REGS := 0
 58   NO_SYSCALL_TABLE := 0
 59   CFLAGS += -I$(OUTPUT)arch/arm64/include/generated
 60   LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
 61 endif
 62 
 63 ifeq ($(SRCARCH),riscv)
 64   NO_PERF_REGS := 0
 65 endif
 66 
 67 ifeq ($(SRCARCH),csky)
 68   NO_PERF_REGS := 0
 69 endif
 70 
 71 ifeq ($(ARCH),s390)
 72   NO_PERF_REGS := 0
 73   NO_SYSCALL_TABLE := 0
 74   CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated
 75 endif
 76 
 77 ifeq ($(NO_PERF_REGS),0)
 78   $(call detected,CONFIG_PERF_REGS)
 79 endif
 80 
 81 ifneq ($(NO_SYSCALL_TABLE),1)
 82   CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT
 83 endif
 84 
 85 # So far there's only x86 and arm libdw unwind support merged in perf.
 86 # Disable it on all other architectures in case libdw unwind
 87 # support is detected in system. Add supported architectures
 88 # to the check.
 89 ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky riscv))
 90   NO_LIBDW_DWARF_UNWIND := 1
 91 endif
 92 
 93 ifeq ($(LIBUNWIND_LIBS),)
 94   NO_LIBUNWIND := 1
 95 endif
 96 #
 97 # For linking with debug library, run like:
 98 #
 99 #   make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
100 #
101 
102 libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code))
103 define libunwind_arch_set_flags_code
104   FEATURE_CHECK_CFLAGS-libunwind-$(1)  = -I$(LIBUNWIND_DIR)/include
105   FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib
106 endef
107 
108 ifdef LIBUNWIND_DIR
109   LIBUNWIND_CFLAGS  = -I$(LIBUNWIND_DIR)/include
110   LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
111   LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64
112   $(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch)))
113 endif
114 
115 # Set per-feature check compilation flags
116 FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
117 FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
118 FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
119 FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
120 
121 FEATURE_CHECK_LDFLAGS-libunwind-arm = -lunwind -lunwind-arm
122 FEATURE_CHECK_LDFLAGS-libunwind-aarch64 = -lunwind -lunwind-aarch64
123 FEATURE_CHECK_LDFLAGS-libunwind-x86 = -lunwind -llzma -lunwind-x86
124 FEATURE_CHECK_LDFLAGS-libunwind-x86_64 = -lunwind -llzma -lunwind-x86_64
125 
126 FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto
127 
128 ifdef CSINCLUDES
129   LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
130 endif
131 OPENCSDLIBS := -lopencsd_c_api -lopencsd
132 ifdef CSLIBS
133   LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
134 endif
135 FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS)
136 FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS)
137 
138 ifeq ($(NO_PERF_REGS),0)
139   CFLAGS += -DHAVE_PERF_REGS_SUPPORT
140 endif
141 
142 # for linking with debug library, run like:
143 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
144 ifdef LIBDW_DIR
145   LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
146   LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
147 endif
148 DWARFLIBS := -ldw
149 ifeq ($(findstring -static,${LDFLAGS}),-static)
150   DWARFLIBS += -lelf -lebl -ldl -lz -llzma -lbz2
151 endif
152 FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
153 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
154 
155 # for linking with debug library, run like:
156 # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
157 ifdef LIBBABELTRACE_DIR
158   LIBBABELTRACE_CFLAGS  := -I$(LIBBABELTRACE_DIR)/include
159   LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
160 endif
161 FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
162 FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
163 
164 ifdef LIBZSTD_DIR
165   LIBZSTD_CFLAGS  := -I$(LIBZSTD_DIR)/lib
166   LIBZSTD_LDFLAGS := -L$(LIBZSTD_DIR)/lib
167 endif
168 FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS)
169 FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS)
170 
171 FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi
172 # include ARCH specific config
173 -include $(src-perf)/arch/$(SRCARCH)/Makefile
174 
175 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
176   CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
177 endif
178 
179 include $(srctree)/tools/scripts/utilities.mak
180 
181 ifeq ($(call get-executable,$(FLEX)),)
182   dummy := $(error Error: $(FLEX) is missing on this system, please install it)
183 endif
184 
185 ifeq ($(call get-executable,$(BISON)),)
186   dummy := $(error Error: $(BISON) is missing on this system, please install it)
187 endif
188 
189 # Treat warnings as errors unless directed not to
190 ifneq ($(WERROR),0)
191   CORE_CFLAGS += -Werror
192   CXXFLAGS += -Werror
193 endif
194 
195 ifndef DEBUG
196   DEBUG := 0
197 endif
198 
199 ifeq ($(DEBUG),0)
200 ifeq ($(CC_NO_CLANG), 0)
201   CORE_CFLAGS += -O3
202 else
203   CORE_CFLAGS += -O6
204 endif
205 endif
206 
207 ifdef PARSER_DEBUG
208   PARSER_DEBUG_BISON := -t
209   PARSER_DEBUG_FLEX  := -d
210   CFLAGS             += -DPARSER_DEBUG
211   $(call detected_var,PARSER_DEBUG_BISON)
212   $(call detected_var,PARSER_DEBUG_FLEX)
213 endif
214 
215 # Try different combinations to accommodate systems that only have
216 # python[2][-config] in weird combinations but always preferring
217 # python2 and python2-config as per pep-0394. If we catch a
218 # python[-config] in version 3, the version check will kill it.
219 PYTHON2 := $(if $(call get-executable,python2),python2,python)
220 override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
221 PYTHON2_CONFIG := \
222   $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
223 override PYTHON_CONFIG := \
224   $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
225 
226 grep-libs  = $(filter -l%,$(1))
227 strip-libs  = $(filter-out -l%,$(1))
228 
229 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
230 
231 # Python 3.8 changed the output of `python-config --ldflags` to not include the
232 # '-lpythonX.Y' flag unless '--embed' is also passed. The feature check for
233 # libpython fails if that flag is not included in LDFLAGS
234 ifeq ($(shell $(PYTHON_CONFIG_SQ) --ldflags --embed 2>&1 1>/dev/null; echo $$?), 0)
235   PYTHON_CONFIG_LDFLAGS := --ldflags --embed
236 else
237   PYTHON_CONFIG_LDFLAGS := --ldflags
238 endif
239 
240 ifdef PYTHON_CONFIG
241   PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) $(PYTHON_CONFIG_LDFLAGS) 2>/dev/null)
242   PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
243   PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
244   PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
245   FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
246 endif
247 
248 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
249 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
250 FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
251 FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
252 
253 FEATURE_CHECK_LDFLAGS-libaio = -lrt
254 
255 FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
256 
257 CORE_CFLAGS += -fno-omit-frame-pointer
258 CORE_CFLAGS += -ggdb3
259 CORE_CFLAGS += -funwind-tables
260 CORE_CFLAGS += -Wall
261 CORE_CFLAGS += -Wextra
262 CORE_CFLAGS += -std=gnu99
263 
264 CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti
265 CXXFLAGS += -Wall
266 CXXFLAGS += -fno-omit-frame-pointer
267 CXXFLAGS += -ggdb3
268 CXXFLAGS += -funwind-tables
269 CXXFLAGS += -Wno-strict-aliasing
270 
271 # Enforce a non-executable stack, as we may regress (again) in the future by
272 # adding assembler files missing the .GNU-stack linker note.
273 LDFLAGS += -Wl,-z,noexecstack
274 
275 EXTLIBS = -lpthread -lrt -lm -ldl
276 
277 ifneq ($(TCMALLOC),)
278   CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
279   EXTLIBS += -ltcmalloc
280 endif
281 
282 ifeq ($(FEATURES_DUMP),)
283 include $(srctree)/tools/build/Makefile.feature
284 else
285 include $(FEATURES_DUMP)
286 endif
287 
288 ifeq ($(feature-stackprotector-all), 1)
289   CORE_CFLAGS += -fstack-protector-all
290 endif
291 
292 ifeq ($(DEBUG),0)
293   ifeq ($(feature-fortify-source), 1)
294     CORE_CFLAGS += -D_FORTIFY_SOURCE=2
295   endif
296 endif
297 
298 INC_FLAGS += -I$(src-perf)/lib/include
299 INC_FLAGS += -I$(src-perf)/util/include
300 INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include
301 INC_FLAGS += -I$(srctree)/tools/include/
302 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
303 INC_FLAGS += -I$(srctree)/tools/include/uapi
304 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
305 INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
306 
307 # $(obj-perf)      for generated common-cmds.h
308 # $(obj-perf)/util for generated bison/flex headers
309 ifneq ($(OUTPUT),)
310 INC_FLAGS += -I$(obj-perf)/util
311 INC_FLAGS += -I$(obj-perf)
312 endif
313 
314 INC_FLAGS += -I$(src-perf)/util
315 INC_FLAGS += -I$(src-perf)
316 INC_FLAGS += -I$(srctree)/tools/lib/
317 
318 CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
319 
320 CFLAGS   += $(CORE_CFLAGS) $(INC_FLAGS)
321 CXXFLAGS += $(INC_FLAGS)
322 
323 LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS)
324 
325 ifeq ($(feature-sync-compare-and-swap), 1)
326   CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
327 endif
328 
329 ifeq ($(feature-pthread-attr-setaffinity-np), 1)
330   CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
331 endif
332 
333 ifeq ($(feature-pthread-barrier), 1)
334   CFLAGS += -DHAVE_PTHREAD_BARRIER
335 endif
336 
337 ifndef NO_BIONIC
338   $(call feature_check,bionic)
339   ifeq ($(feature-bionic), 1)
340     BIONIC := 1
341     CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE
342     CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE
343     EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
344     EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
345   endif
346 endif
347 
348 ifeq ($(feature-eventfd), 1)
349   CFLAGS += -DHAVE_EVENTFD
350 endif
351 
352 ifeq ($(feature-get_current_dir_name), 1)
353   CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
354 endif
355 
356 ifeq ($(feature-gettid), 1)
357   CFLAGS += -DHAVE_GETTID
358 endif
359 
360 ifdef NO_LIBELF
361   NO_DWARF := 1
362   NO_DEMANGLE := 1
363   NO_LIBUNWIND := 1
364   NO_LIBDW_DWARF_UNWIND := 1
365   NO_LIBBPF := 1
366   NO_JVMTI := 1
367 else
368   ifeq ($(feature-libelf), 0)
369     ifeq ($(feature-glibc), 1)
370       LIBC_SUPPORT := 1
371     endif
372     ifeq ($(BIONIC),1)
373       LIBC_SUPPORT := 1
374     endif
375     ifeq ($(LIBC_SUPPORT),1)
376       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);
377 
378       NO_LIBELF := 1
379       NO_DWARF := 1
380       NO_DEMANGLE := 1
381       NO_LIBUNWIND := 1
382       NO_LIBDW_DWARF_UNWIND := 1
383       NO_LIBBPF := 1
384       NO_JVMTI := 1
385     else
386       ifneq ($(filter s% -static%,$(LDFLAGS),),)
387         msg := $(error No static glibc found, please install glibc-static);
388       else
389         msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
390       endif
391     endif
392   else
393     ifndef NO_LIBDW_DWARF_UNWIND
394       ifneq ($(feature-libdw-dwarf-unwind),1)
395         NO_LIBDW_DWARF_UNWIND := 1
396         msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
397       endif
398     endif
399     ifneq ($(feature-dwarf), 1)
400       ifndef NO_DWARF
401         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);
402         NO_DWARF := 1
403       endif
404     else
405       ifneq ($(feature-dwarf_getlocations), 1)
406         msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
407       else
408         CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
409       endif # dwarf_getlocations
410     endif # Dwarf support
411   endif # libelf support
412 endif # NO_LIBELF
413 
414 ifeq ($(feature-glibc), 1)
415   CFLAGS += -DHAVE_GLIBC_SUPPORT
416 endif
417 
418 ifeq ($(feature-libaio), 1)
419   ifndef NO_AIO
420     CFLAGS += -DHAVE_AIO_SUPPORT
421   endif
422 endif
423 
424 ifdef NO_DWARF
425   NO_LIBDW_DWARF_UNWIND := 1
426 endif
427 
428 ifeq ($(feature-sched_getcpu), 1)
429   CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
430 endif
431 
432 ifeq ($(feature-setns), 1)
433   CFLAGS += -DHAVE_SETNS_SUPPORT
434   $(call detected,CONFIG_SETNS)
435 endif
436 
437 ifdef CORESIGHT
438   $(call feature_check,libopencsd)
439   ifeq ($(feature-libopencsd), 1)
440     CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
441     ifeq ($(feature-reallocarray), 0)
442       CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
443     endif
444     LDFLAGS += $(LIBOPENCSD_LDFLAGS)
445     EXTLIBS += $(OPENCSDLIBS)
446     $(call detected,CONFIG_LIBOPENCSD)
447     ifdef CSTRACE_RAW
448       CFLAGS += -DCS_DEBUG_RAW
449       ifeq (${CSTRACE_RAW}, packed)
450         CFLAGS += -DCS_RAW_PACKED
451       endif
452     endif
453   endif
454 endif
455 
456 ifndef NO_LIBELF
457   CFLAGS += -DHAVE_LIBELF_SUPPORT
458   EXTLIBS += -lelf
459   $(call detected,CONFIG_LIBELF)
460 
461   ifeq ($(feature-libelf-mmap), 1)
462     CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
463   endif
464 
465   ifeq ($(feature-libelf-getphdrnum), 1)
466     CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
467   endif
468 
469   ifeq ($(feature-libelf-gelf_getnote), 1)
470     CFLAGS += -DHAVE_GELF_GETNOTE_SUPPORT
471   else
472     msg := $(warning gelf_getnote() not found on libelf, SDT support disabled);
473   endif
474 
475   ifeq ($(feature-libelf-getshdrstrndx), 1)
476     CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
477   endif
478 
479   ifndef NO_DWARF
480     ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
481       msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);
482       NO_DWARF := 1
483     else
484       CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
485       LDFLAGS += $(LIBDW_LDFLAGS)
486       EXTLIBS += ${DWARFLIBS}
487       $(call detected,CONFIG_DWARF)
488     endif # PERF_HAVE_DWARF_REGS
489   endif # NO_DWARF
490 
491   ifndef NO_LIBBPF
492     ifeq ($(feature-bpf), 1)
493       CFLAGS += -DHAVE_LIBBPF_SUPPORT
494       $(call detected,CONFIG_LIBBPF)
495 
496       # detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status
497       $(call feature_check,libbpf)
498       ifdef LIBBPF_DYNAMIC
499         ifeq ($(feature-libbpf), 1)
500           EXTLIBS += -lbpf
501         else
502           dummy := $(error Error: No libbpf devel library found, please install libbpf-devel);
503         endif
504       endif
505     endif
506 
507     ifndef NO_DWARF
508       ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
509         CFLAGS += -DHAVE_BPF_PROLOGUE
510         $(call detected,CONFIG_BPF_PROLOGUE)
511       else
512         msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset());
513       endif
514     else
515       msg := $(warning DWARF support is off, BPF prologue is disabled);
516     endif
517 
518   endif # NO_LIBBPF
519 endif # NO_LIBELF
520 
521 ifndef NO_SDT
522   ifneq ($(feature-sdt), 1)
523     msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev);
524     NO_SDT := 1;
525   else
526     CFLAGS += -DHAVE_SDT_EVENT
527     $(call detected,CONFIG_SDT_EVENT)
528   endif
529 endif
530 
531 ifdef PERF_HAVE_JITDUMP
532   ifndef NO_LIBELF
533     $(call detected,CONFIG_JITDUMP)
534     CFLAGS += -DHAVE_JITDUMP
535   endif
536 endif
537 
538 ifeq ($(SRCARCH),powerpc)
539   ifndef NO_DWARF
540     CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
541   endif
542 endif
543 
544 ifndef NO_LIBUNWIND
545   have_libunwind :=
546 
547   $(call feature_check,libunwind-x86)
548   ifeq ($(feature-libunwind-x86), 1)
549     $(call detected,CONFIG_LIBUNWIND_X86)
550     CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
551     LDFLAGS += -lunwind-x86
552     EXTLIBS_LIBUNWIND += -lunwind-x86
553     have_libunwind = 1
554   endif
555 
556   $(call feature_check,libunwind-aarch64)
557   ifeq ($(feature-libunwind-aarch64), 1)
558     $(call detected,CONFIG_LIBUNWIND_AARCH64)
559     CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
560     LDFLAGS += -lunwind-aarch64
561     EXTLIBS_LIBUNWIND += -lunwind-aarch64
562     have_libunwind = 1
563     $(call feature_check,libunwind-debug-frame-aarch64)
564     ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
565       msg := $(warning No debug_frame support found in libunwind-aarch64);
566       CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
567     endif
568   endif
569 
570   ifneq ($(feature-libunwind), 1)
571     msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
572     NO_LOCAL_LIBUNWIND := 1
573   else
574     have_libunwind := 1
575     $(call detected,CONFIG_LOCAL_LIBUNWIND)
576   endif
577 
578   ifneq ($(have_libunwind), 1)
579     NO_LIBUNWIND := 1
580   endif
581 else
582   NO_LOCAL_LIBUNWIND := 1
583 endif
584 
585 ifndef NO_LIBBPF
586   ifneq ($(feature-bpf), 1)
587     msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
588     NO_LIBBPF := 1
589   endif
590 endif
591 
592 dwarf-post-unwind := 1
593 dwarf-post-unwind-text := BUG
594 
595 # setup DWARF post unwinder
596 ifdef NO_LIBUNWIND
597   ifdef NO_LIBDW_DWARF_UNWIND
598     msg := $(warning Disabling post unwind, no support found.);
599     dwarf-post-unwind := 0
600   else
601     dwarf-post-unwind-text := libdw
602     $(call detected,CONFIG_LIBDW_DWARF_UNWIND)
603   endif
604 else
605   dwarf-post-unwind-text := libunwind
606   $(call detected,CONFIG_LIBUNWIND)
607   # Enable libunwind support by default.
608   ifndef NO_LIBDW_DWARF_UNWIND
609     NO_LIBDW_DWARF_UNWIND := 1
610   endif
611 endif
612 
613 ifeq ($(dwarf-post-unwind),1)
614   CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
615   $(call detected,CONFIG_DWARF_UNWIND)
616 else
617   NO_DWARF_UNWIND := 1
618 endif
619 
620 ifndef NO_LOCAL_LIBUNWIND
621   ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64))
622     $(call feature_check,libunwind-debug-frame)
623     ifneq ($(feature-libunwind-debug-frame), 1)
624       msg := $(warning No debug_frame support found in libunwind);
625       CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
626     endif
627   else
628     # non-ARM has no dwarf_find_debug_frame() function:
629     CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
630   endif
631   EXTLIBS += $(LIBUNWIND_LIBS)
632   LDFLAGS += $(LIBUNWIND_LIBS)
633 endif
634 ifeq ($(findstring -static,${LDFLAGS}),-static)
635   # gcc -static links libgcc_eh which contans piece of libunwind
636   LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition
637 endif
638 
639 ifndef NO_LIBUNWIND
640   CFLAGS  += -DHAVE_LIBUNWIND_SUPPORT
641   CFLAGS  += $(LIBUNWIND_CFLAGS)
642   LDFLAGS += $(LIBUNWIND_LDFLAGS)
643   EXTLIBS += $(EXTLIBS_LIBUNWIND)
644 endif
645 
646 ifeq ($(NO_SYSCALL_TABLE),0)
647   $(call detected,CONFIG_TRACE)
648 else
649   ifndef NO_LIBAUDIT
650     ifneq ($(feature-libaudit), 1)
651       msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
652       NO_LIBAUDIT := 1
653     else
654       CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
655       EXTLIBS += -laudit
656       $(call detected,CONFIG_TRACE)
657     endif
658   endif
659 endif
660 
661 ifndef NO_LIBCRYPTO
662   ifneq ($(feature-libcrypto), 1)
663     msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev);
664     NO_LIBCRYPTO := 1
665   else
666     CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
667     EXTLIBS += -lcrypto
668     $(call detected,CONFIG_CRYPTO)
669   endif
670 endif
671 
672 ifdef NO_NEWT
673   NO_SLANG=1
674 endif
675 
676 ifndef NO_SLANG
677   ifneq ($(feature-libslang), 1)
678     ifneq ($(feature-libslang-include-subdir), 1)
679       msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev);
680       NO_SLANG := 1
681     else
682       CFLAGS += -DHAVE_SLANG_INCLUDE_SUBDIR
683     endif
684   endif
685   ifndef NO_SLANG
686     # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
687     CFLAGS += -DHAVE_SLANG_SUPPORT
688     EXTLIBS += -lslang
689     $(call detected,CONFIG_SLANG)
690   endif
691 endif
692 
693 ifndef NO_GTK2
694   FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
695   ifneq ($(feature-gtk2), 1)
696     msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
697     NO_GTK2 := 1
698   else
699     ifeq ($(feature-gtk2-infobar), 1)
700       GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
701     endif
702     CFLAGS += -DHAVE_GTK2_SUPPORT
703     GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
704     GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
705     EXTLIBS += -ldl
706   endif
707 endif
708 
709 ifdef NO_LIBPERL
710   CFLAGS += -DNO_LIBPERL
711 else
712   PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
713   PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
714   PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
715   PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
716   PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
717   PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
718   FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
719 
720   ifneq ($(feature-libperl), 1)
721     CFLAGS += -DNO_LIBPERL
722     NO_LIBPERL := 1
723     msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev);
724   else
725     LDFLAGS += $(PERL_EMBED_LDFLAGS)
726     EXTLIBS += $(PERL_EMBED_LIBADD)
727     CFLAGS += -DHAVE_LIBPERL_SUPPORT
728     $(call detected,CONFIG_LIBPERL)
729   endif
730 endif
731 
732 ifeq ($(feature-timerfd), 1)
733   CFLAGS += -DHAVE_TIMERFD_SUPPORT
734 else
735   msg := $(warning No timerfd support. Disables 'perf kvm stat live');
736 endif
737 
738 disable-python = $(eval $(disable-python_code))
739 define disable-python_code
740   CFLAGS += -DNO_LIBPYTHON
741   $(warning $1)
742   NO_LIBPYTHON := 1
743 endef
744 
745 ifdef NO_LIBPYTHON
746   $(call disable-python,Python support disabled by user)
747 else
748 
749   ifndef PYTHON
750     $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev)
751   else
752     PYTHON_WORD := $(call shell-wordify,$(PYTHON))
753 
754     ifndef PYTHON_CONFIG
755       $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
756     else
757 
758       ifneq ($(feature-libpython), 1)
759         $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
760       else
761          LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
762          EXTLIBS += $(PYTHON_EMBED_LIBADD)
763          LANG_BINDINGS += $(obj-perf)python/perf.so
764          CFLAGS += -DHAVE_LIBPYTHON_SUPPORT
765          $(call detected,CONFIG_LIBPYTHON)
766       endif
767     endif
768   endif
769 endif
770 
771 ifeq ($(feature-libbfd), 1)
772   EXTLIBS += -lbfd -lopcodes
773 else
774   # we are on a system that requires -liberty and (maybe) -lz
775   # to link against -lbfd; test each case individually here
776 
777   # call all detections now so we get correct
778   # status in VF output
779   $(call feature_check,libbfd-liberty)
780   $(call feature_check,libbfd-liberty-z)
781 
782   ifeq ($(feature-libbfd-liberty), 1)
783     EXTLIBS += -lbfd -lopcodes -liberty
784     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
785   else
786     ifeq ($(feature-libbfd-liberty-z), 1)
787       EXTLIBS += -lbfd -lopcodes -liberty -lz
788       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
789     endif
790   endif
791   $(call feature_check,disassembler-four-args)
792 endif
793 
794 ifdef NO_DEMANGLE
795   CFLAGS += -DNO_DEMANGLE
796 else
797   ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
798     EXTLIBS += -liberty
799   else
800     ifeq ($(filter -liberty,$(EXTLIBS)),)
801       $(call feature_check,cplus-demangle)
802 
803       # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
804       # or any of 'bfd iberty z' trinity
805       ifeq ($(feature-cplus-demangle), 1)
806         EXTLIBS += -liberty
807       else
808         msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
809         CFLAGS += -DNO_DEMANGLE
810       endif
811     endif
812   endif
813 
814   ifneq ($(filter -liberty,$(EXTLIBS)),)
815     CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
816   endif
817 endif
818 
819 ifneq ($(filter -lbfd,$(EXTLIBS)),)
820   CFLAGS += -DHAVE_LIBBFD_SUPPORT
821 endif
822 
823 ifndef NO_ZLIB
824   ifeq ($(feature-zlib), 1)
825     CFLAGS += -DHAVE_ZLIB_SUPPORT
826     EXTLIBS += -lz
827     $(call detected,CONFIG_ZLIB)
828   else
829     NO_ZLIB := 1
830   endif
831 endif
832 
833 ifndef NO_LZMA
834   ifeq ($(feature-lzma), 1)
835     CFLAGS += -DHAVE_LZMA_SUPPORT
836     EXTLIBS += -llzma
837     $(call detected,CONFIG_LZMA)
838   else
839     msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev);
840     NO_LZMA := 1
841   endif
842 endif
843 
844 ifndef NO_LIBZSTD
845   ifeq ($(feature-libzstd), 1)
846     CFLAGS += -DHAVE_ZSTD_SUPPORT
847     CFLAGS += $(LIBZSTD_CFLAGS)
848     LDFLAGS += $(LIBZSTD_LDFLAGS)
849     EXTLIBS += -lzstd
850     $(call detected,CONFIG_ZSTD)
851   else
852     msg := $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR);
853     NO_LIBZSTD := 1
854   endif
855 endif
856 
857 ifndef NO_LIBCAP
858   ifeq ($(feature-libcap), 1)
859     CFLAGS += -DHAVE_LIBCAP_SUPPORT
860     EXTLIBS += -lcap
861     $(call detected,CONFIG_LIBCAP)
862   else
863     msg := $(warning No libcap found, disables capability support, please install libcap-devel/libcap-dev);
864     NO_LIBCAP := 1
865   endif
866 endif
867 
868 ifndef NO_BACKTRACE
869   ifeq ($(feature-backtrace), 1)
870     CFLAGS += -DHAVE_BACKTRACE_SUPPORT
871   endif
872 endif
873 
874 ifndef NO_LIBNUMA
875   ifeq ($(feature-libnuma), 0)
876     msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
877     NO_LIBNUMA := 1
878   else
879     ifeq ($(feature-numa_num_possible_cpus), 0)
880       msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8);
881       NO_LIBNUMA := 1
882     else
883       CFLAGS += -DHAVE_LIBNUMA_SUPPORT
884       EXTLIBS += -lnuma
885       $(call detected,CONFIG_NUMA)
886     endif
887   endif
888 endif
889 
890 ifdef HAVE_KVM_STAT_SUPPORT
891     CFLAGS += -DHAVE_KVM_STAT_SUPPORT
892 endif
893 
894 ifeq ($(feature-disassembler-four-args), 1)
895     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
896 endif
897 
898 ifeq (${IS_64_BIT}, 1)
899   ifndef NO_PERF_READ_VDSO32
900     $(call feature_check,compile-32)
901     ifeq ($(feature-compile-32), 1)
902       CFLAGS += -DHAVE_PERF_READ_VDSO32
903     else
904       NO_PERF_READ_VDSO32 := 1
905     endif
906   endif
907   ifneq ($(SRCARCH), x86)
908     NO_PERF_READ_VDSOX32 := 1
909   endif
910   ifndef NO_PERF_READ_VDSOX32
911     $(call feature_check,compile-x32)
912     ifeq ($(feature-compile-x32), 1)
913       CFLAGS += -DHAVE_PERF_READ_VDSOX32
914     else
915       NO_PERF_READ_VDSOX32 := 1
916     endif
917   endif
918 else
919   NO_PERF_READ_VDSO32 := 1
920   NO_PERF_READ_VDSOX32 := 1
921 endif
922 
923 ifndef NO_LIBBABELTRACE
924   $(call feature_check,libbabeltrace)
925   ifeq ($(feature-libbabeltrace), 1)
926     CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
927     LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
928     EXTLIBS += -lbabeltrace-ctf
929     $(call detected,CONFIG_LIBBABELTRACE)
930   else
931     msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
932   endif
933 endif
934 
935 ifndef NO_AUXTRACE
936   ifeq ($(SRCARCH),x86)
937     ifeq ($(feature-get_cpuid), 0)
938       msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
939       NO_AUXTRACE := 1
940     endif
941   endif
942   ifndef NO_AUXTRACE
943     $(call detected,CONFIG_AUXTRACE)
944     CFLAGS += -DHAVE_AUXTRACE_SUPPORT
945   endif
946 endif
947 
948 ifndef NO_JVMTI
949   ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
950     JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
951   else
952     ifneq (,$(wildcard /usr/sbin/alternatives))
953       JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g')
954     endif
955   endif
956   ifndef JDIR
957     $(warning No alternatives command found, you need to set JDIR= to point to the root of your Java directory)
958     NO_JVMTI := 1
959   endif
960 endif
961 
962 ifndef NO_JVMTI
963   FEATURE_CHECK_CFLAGS-jvmti := -I$(JDIR)/include -I$(JDIR)/include/linux
964   $(call feature_check,jvmti)
965   ifeq ($(feature-jvmti), 1)
966     $(call detected_var,JDIR)
967     ifndef NO_JVMTI_CMLR
968       FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti)
969       $(call feature_check,jvmti-cmlr)
970       ifeq ($(feature-jvmti-cmlr), 1)
971         CFLAGS += -DHAVE_JVMTI_CMLR
972       endif
973     endif # NO_JVMTI_CMLR
974   else
975     $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel)
976     NO_JVMTI := 1
977   endif
978 endif
979 
980 USE_CXX = 0
981 USE_CLANGLLVM = 0
982 ifdef LIBCLANGLLVM
983   $(call feature_check,cxx)
984   ifneq ($(feature-cxx), 1)
985     msg := $(warning No g++ found, disable clang and llvm support. Please install g++)
986   else
987     $(call feature_check,llvm)
988     $(call feature_check,llvm-version)
989     ifneq ($(feature-llvm), 1)
990       msg := $(warning No suitable libLLVM found, disabling builtin clang and LLVM support. Please install llvm-dev(el) (>= 3.9.0))
991     else
992       $(call feature_check,clang)
993       ifneq ($(feature-clang), 1)
994         msg := $(warning No suitable libclang found, disabling builtin clang and LLVM support. Please install libclang-dev(el) (>= 3.9.0))
995       else
996         CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT
997         CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir)
998         $(call detected,CONFIG_CXX)
999         $(call detected,CONFIG_CLANGLLVM)
1000         USE_CXX = 1
1001         USE_LLVM = 1
1002         USE_CLANG = 1
1003         ifneq ($(feature-llvm-version),1)
1004           msg := $(warning This version of LLVM is not tested. May cause build errors)
1005         endif
1006       endif
1007     endif
1008   endif
1009 endif
1010 
1011 # Among the variables below, these:
1012 #   perfexecdir
1013 #   perf_include_dir
1014 #   perf_examples_dir
1015 #   template_dir
1016 #   mandir
1017 #   infodir
1018 #   htmldir
1019 #   ETC_PERFCONFIG (but not sysconfdir)
1020 # can be specified as a relative path some/where/else;
1021 # this is interpreted as relative to $(prefix) and "perf" at
1022 # runtime figures out where they are based on the path to the executable.
1023 # This can help installing the suite in a relocatable way.
1024 
1025 # Make the path relative to DESTDIR, not to prefix
1026 ifndef DESTDIR
1027 prefix ?= $(HOME)
1028 endif
1029 bindir_relative = bin
1030 bindir = $(abspath $(prefix)/$(bindir_relative))
1031 mandir = share/man
1032 infodir = share/info
1033 perfexecdir = libexec/perf-core
1034 perf_include_dir = lib/perf/include
1035 perf_examples_dir = lib/perf/examples
1036 sharedir = $(prefix)/share
1037 template_dir = share/perf-core/templates
1038 STRACE_GROUPS_DIR = share/perf-core/strace/groups
1039 htmldir = share/doc/perf-doc
1040 tipdir = share/doc/perf-tip
1041 srcdir = $(srctree)/tools/perf
1042 ifeq ($(prefix),/usr)
1043 sysconfdir = /etc
1044 ETC_PERFCONFIG = $(sysconfdir)/perfconfig
1045 else
1046 sysconfdir = $(prefix)/etc
1047 ETC_PERFCONFIG = etc/perfconfig
1048 endif
1049 ifndef lib
1050 ifeq ($(SRCARCH)$(IS_64_BIT), x861)
1051 lib = lib64
1052 else
1053 lib = lib
1054 endif
1055 endif # lib
1056 libdir = $(prefix)/$(lib)
1057 
1058 # Shell quote (do not use $(call) to accommodate ancient setups);
1059 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
1060 STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR))
1061 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1062 bindir_SQ = $(subst ','\'',$(bindir))
1063 mandir_SQ = $(subst ','\'',$(mandir))
1064 infodir_SQ = $(subst ','\'',$(infodir))
1065 perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
1066 perf_include_dir_SQ = $(subst ','\'',$(perf_include_dir))
1067 perf_examples_dir_SQ = $(subst ','\'',$(perf_examples_dir))
1068 template_dir_SQ = $(subst ','\'',$(template_dir))
1069 htmldir_SQ = $(subst ','\'',$(htmldir))
1070 tipdir_SQ = $(subst ','\'',$(tipdir))
1071 prefix_SQ = $(subst ','\'',$(prefix))
1072 sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
1073 libdir_SQ = $(subst ','\'',$(libdir))
1074 srcdir_SQ = $(subst ','\'',$(srcdir))
1075 
1076 ifneq ($(filter /%,$(firstword $(perfexecdir))),)
1077 perfexec_instdir = $(perfexecdir)
1078 perf_include_instdir = $(perf_include_dir)
1079 perf_examples_instdir = $(perf_examples_dir)
1080 STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR)
1081 tip_instdir = $(tipdir)
1082 else
1083 perfexec_instdir = $(prefix)/$(perfexecdir)
1084 perf_include_instdir = $(prefix)/$(perf_include_dir)
1085 perf_examples_instdir = $(prefix)/$(perf_examples_dir)
1086 STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR)
1087 tip_instdir = $(prefix)/$(tipdir)
1088 endif
1089 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
1090 perf_include_instdir_SQ = $(subst ','\'',$(perf_include_instdir))
1091 perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir))
1092 STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR))
1093 tip_instdir_SQ = $(subst ','\'',$(tip_instdir))
1094 
1095 # If we install to $(HOME) we keep the traceevent default:
1096 # $(HOME)/.traceevent/plugins
1097 # Otherwise we install plugins into the global $(libdir).
1098 ifdef DESTDIR
1099 plugindir=$(libdir)/traceevent/plugins
1100 plugindir_SQ= $(subst ','\'',$(plugindir))
1101 endif
1102 
1103 print_var = $(eval $(print_var_code)) $(info $(MSG))
1104 define print_var_code
1105     MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
1106 endef
1107 
1108 ifeq ($(VF),1)
1109   # Display EXTRA features which are detected manualy
1110   # from here with feature_check call and thus cannot
1111   # be partof global state output.
1112   $(foreach feat,$(FEATURE_TESTS_EXTRA),$(call feature_print_status,$(feat),))
1113   $(call print_var,prefix)
1114   $(call print_var,bindir)
1115   $(call print_var,libdir)
1116   $(call print_var,sysconfdir)
1117   $(call print_var,LIBUNWIND_DIR)
1118   $(call print_var,LIBDW_DIR)
1119   $(call print_var,JDIR)
1120 
1121   ifeq ($(dwarf-post-unwind),1)
1122     $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
1123   endif
1124   $(info )
1125 endif
1126 
1127 $(call detected_var,bindir_SQ)
1128 $(call detected_var,PYTHON_WORD)
1129 ifneq ($(OUTPUT),)
1130 $(call detected_var,OUTPUT)
1131 endif
1132 $(call detected_var,htmldir_SQ)
1133 $(call detected_var,infodir_SQ)
1134 $(call detected_var,mandir_SQ)
1135 $(call detected_var,ETC_PERFCONFIG_SQ)
1136 $(call detected_var,STRACE_GROUPS_DIR_SQ)
1137 $(call detected_var,prefix_SQ)
1138 $(call detected_var,perfexecdir_SQ)
1139 $(call detected_var,perf_include_dir_SQ)
1140 $(call detected_var,perf_examples_dir_SQ)
1141 $(call detected_var,tipdir_SQ)
1142 $(call detected_var,srcdir_SQ)
1143 $(call detected_var,LIBDIR)
1144 $(call detected_var,GTK_CFLAGS)
1145 $(call detected_var,PERL_EMBED_CCOPTS)
1146 $(call detected_var,PYTHON_EMBED_CCOPTS)

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp