Makefile 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. ifeq ($(src-perf),)
  2. src-perf := $(srctree)/tools/perf
  3. endif
  4. ifeq ($(obj-perf),)
  5. obj-perf := $(OUTPUT)
  6. endif
  7. ifneq ($(obj-perf),)
  8. obj-perf := $(abspath $(obj-perf))/
  9. endif
  10. LIB_INCLUDE := $(srctree)/tools/lib/
  11. CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
  12. include $(src-perf)/config/Makefile.arch
  13. NO_PERF_REGS := 1
  14. # Additional ARCH settings for x86
  15. ifeq ($(ARCH),x86)
  16. ifeq (${IS_X86_64}, 1)
  17. CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
  18. ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
  19. LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
  20. else
  21. LIBUNWIND_LIBS = -lunwind -lunwind-x86
  22. endif
  23. NO_PERF_REGS := 0
  24. endif
  25. ifeq ($(ARCH),arm)
  26. NO_PERF_REGS := 0
  27. LIBUNWIND_LIBS = -lunwind -lunwind-arm
  28. endif
  29. ifeq ($(LIBUNWIND_LIBS),)
  30. NO_LIBUNWIND := 1
  31. else
  32. #
  33. # For linking with debug library, run like:
  34. #
  35. # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
  36. #
  37. ifdef LIBUNWIND_DIR
  38. LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
  39. LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
  40. endif
  41. LIBUNWIND_LDFLAGS += $(LIBUNWIND_LIBS)
  42. # Set per-feature check compilation flags
  43. FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
  44. FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS)
  45. FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
  46. FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
  47. endif
  48. ifeq ($(NO_PERF_REGS),0)
  49. CFLAGS += -DHAVE_PERF_REGS_SUPPORT
  50. endif
  51. # include ARCH specific config
  52. -include $(src-perf)/arch/$(ARCH)/Makefile
  53. include $(src-perf)/config/utilities.mak
  54. ifeq ($(call get-executable,$(FLEX)),)
  55. dummy := $(error Error: $(FLEX) is missing on this system, please install it)
  56. endif
  57. ifeq ($(call get-executable,$(BISON)),)
  58. dummy := $(error Error: $(BISON) is missing on this system, please install it)
  59. endif
  60. # Treat warnings as errors unless directed not to
  61. ifneq ($(WERROR),0)
  62. CFLAGS += -Werror
  63. endif
  64. ifndef DEBUG
  65. DEBUG := 0
  66. endif
  67. ifeq ($(DEBUG),0)
  68. CFLAGS += -O6
  69. endif
  70. ifdef PARSER_DEBUG
  71. PARSER_DEBUG_BISON := -t
  72. PARSER_DEBUG_FLEX := -d
  73. CFLAGS += -DPARSER_DEBUG
  74. endif
  75. CFLAGS += -fno-omit-frame-pointer
  76. CFLAGS += -ggdb3
  77. CFLAGS += -funwind-tables
  78. CFLAGS += -Wall
  79. CFLAGS += -Wextra
  80. CFLAGS += -std=gnu99
  81. EXTLIBS = -lelf -lpthread -lrt -lm -ldl
  82. ifneq ($(OUTPUT),)
  83. OUTPUT_FEATURES = $(OUTPUT)config/feature-checks/
  84. $(shell mkdir -p $(OUTPUT_FEATURES))
  85. endif
  86. feature_check = $(eval $(feature_check_code))
  87. define feature_check_code
  88. feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
  89. endef
  90. feature_set = $(eval $(feature_set_code))
  91. define feature_set_code
  92. feature-$(1) := 1
  93. endef
  94. #
  95. # Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output:
  96. #
  97. #
  98. # Note that this is not a complete list of all feature tests, just
  99. # those that are typically built on a fully configured system.
  100. #
  101. # [ Feature tests not mentioned here have to be built explicitly in
  102. # the rule that uses them - an example for that is the 'bionic'
  103. # feature check. ]
  104. #
  105. CORE_FEATURE_TESTS = \
  106. backtrace \
  107. dwarf \
  108. fortify-source \
  109. glibc \
  110. gtk2 \
  111. gtk2-infobar \
  112. libaudit \
  113. libbfd \
  114. libelf \
  115. libelf-getphdrnum \
  116. libelf-mmap \
  117. libnuma \
  118. libperl \
  119. libpython \
  120. libpython-version \
  121. libslang \
  122. libunwind \
  123. on-exit \
  124. stackprotector-all \
  125. timerfd
  126. # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features.
  127. # If in the future we need per-feature checks/flags for features not
  128. # mentioned in this list we need to refactor this ;-).
  129. set_test_all_flags = $(eval $(set_test_all_flags_code))
  130. define set_test_all_flags_code
  131. FEATURE_CHECK_CFLAGS-all += $(FEATURE_CHECK_CFLAGS-$(1))
  132. FEATURE_CHECK_LDFLAGS-all += $(FEATURE_CHECK_LDFLAGS-$(1))
  133. endef
  134. $(foreach feat,$(CORE_FEATURE_TESTS),$(call set_test_all_flags,$(feat)))
  135. #
  136. # So here we detect whether test-all was rebuilt, to be able
  137. # to skip the print-out of the long features list if the file
  138. # existed before and after it was built:
  139. #
  140. ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all.bin),)
  141. test-all-failed := 1
  142. else
  143. test-all-failed := 0
  144. endif
  145. #
  146. # Special fast-path for the 'all features are available' case:
  147. #
  148. $(call feature_check,all,$(MSG))
  149. #
  150. # Just in case the build freshly failed, make sure we print the
  151. # feature matrix:
  152. #
  153. ifeq ($(feature-all), 0)
  154. test-all-failed := 1
  155. endif
  156. ifeq ($(test-all-failed),1)
  157. $(info )
  158. $(info Auto-detecting system features:)
  159. endif
  160. ifeq ($(feature-all), 1)
  161. #
  162. # test-all.c passed - just set all the core feature flags to 1:
  163. #
  164. $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
  165. else
  166. $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix .bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
  167. $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
  168. endif
  169. #
  170. # Print the result of the feature test:
  171. #
  172. feature_print = $(eval $(feature_print_code)) $(info $(MSG))
  173. define feature_print_code
  174. ifeq ($(feature-$(1)), 1)
  175. MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1))
  176. else
  177. MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1))
  178. endif
  179. endef
  180. #
  181. # Only print out our features if we rebuilt the testcases or if a test failed:
  182. #
  183. ifeq ($(test-all-failed), 1)
  184. $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_print,$(feat)))
  185. $(info )
  186. endif
  187. ifeq ($(feature-stackprotector-all), 1)
  188. CFLAGS += -fstack-protector-all
  189. endif
  190. ifeq ($(DEBUG),0)
  191. ifeq ($(feature-fortify-source), 1)
  192. CFLAGS += -D_FORTIFY_SOURCE=2
  193. endif
  194. endif
  195. CFLAGS += -I$(src-perf)/util/include
  196. CFLAGS += -I$(src-perf)/arch/$(ARCH)/include
  197. CFLAGS += -I$(srctree)/tools/include/
  198. CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi
  199. CFLAGS += -I$(srctree)/arch/$(ARCH)/include
  200. CFLAGS += -I$(srctree)/include/uapi
  201. CFLAGS += -I$(srctree)/include
  202. # $(obj-perf) for generated common-cmds.h
  203. # $(obj-perf)/util for generated bison/flex headers
  204. ifneq ($(OUTPUT),)
  205. CFLAGS += -I$(obj-perf)/util
  206. CFLAGS += -I$(obj-perf)
  207. endif
  208. CFLAGS += -I$(src-perf)/util
  209. CFLAGS += -I$(src-perf)
  210. CFLAGS += -I$(LIB_INCLUDE)
  211. CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
  212. ifndef NO_BIONIC
  213. $(call feature_check,bionic)
  214. ifeq ($(feature-bionic), 1)
  215. BIONIC := 1
  216. EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
  217. EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
  218. endif
  219. endif
  220. ifdef NO_LIBELF
  221. NO_DWARF := 1
  222. NO_DEMANGLE := 1
  223. NO_LIBUNWIND := 1
  224. else
  225. ifeq ($(feature-libelf), 0)
  226. ifeq ($(feature-glibc), 1)
  227. LIBC_SUPPORT := 1
  228. endif
  229. ifeq ($(BIONIC),1)
  230. LIBC_SUPPORT := 1
  231. endif
  232. ifeq ($(LIBC_SUPPORT),1)
  233. msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
  234. NO_LIBELF := 1
  235. NO_DWARF := 1
  236. NO_DEMANGLE := 1
  237. else
  238. msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
  239. endif
  240. else
  241. # for linking with debug library, run like:
  242. # make DEBUG=1 LIBDW_DIR=/opt/libdw/
  243. ifdef LIBDW_DIR
  244. LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
  245. LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
  246. endif
  247. ifneq ($(feature-dwarf), 1)
  248. 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);
  249. NO_DWARF := 1
  250. endif # Dwarf support
  251. endif # libelf support
  252. endif # NO_LIBELF
  253. ifndef NO_LIBELF
  254. CFLAGS += -DHAVE_LIBELF_SUPPORT
  255. ifeq ($(feature-libelf-mmap), 1)
  256. CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
  257. endif
  258. ifeq ($(feature-libelf-getphdrnum), 1)
  259. CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
  260. endif
  261. # include ARCH specific config
  262. -include $(src-perf)/arch/$(ARCH)/Makefile
  263. ifndef NO_DWARF
  264. ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
  265. msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
  266. NO_DWARF := 1
  267. else
  268. CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
  269. LDFLAGS += $(LIBDW_LDFLAGS)
  270. EXTLIBS += -lelf -ldw
  271. endif # PERF_HAVE_DWARF_REGS
  272. endif # NO_DWARF
  273. endif # NO_LIBELF
  274. ifndef NO_LIBUNWIND
  275. ifneq ($(feature-libunwind), 1)
  276. msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
  277. NO_LIBUNWIND := 1
  278. else
  279. ifeq ($(ARCH),arm)
  280. $(call feature_check,libunwind-debug-frame)
  281. ifneq ($(feature-libunwind-debug-frame), 1)
  282. msg := $(warning No debug_frame support found in libunwind);
  283. CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
  284. endif
  285. else
  286. # non-ARM has no dwarf_find_debug_frame() function:
  287. CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
  288. endif
  289. CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
  290. EXTLIBS += $(LIBUNWIND_LIBS)
  291. CFLAGS += $(LIBUNWIND_CFLAGS)
  292. LDFLAGS += $(LIBUNWIND_LDFLAGS)
  293. endif # ifneq ($(feature-libunwind), 1)
  294. endif
  295. ifndef NO_LIBAUDIT
  296. ifneq ($(feature-libaudit), 1)
  297. msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
  298. NO_LIBAUDIT := 1
  299. else
  300. CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
  301. EXTLIBS += -laudit
  302. endif
  303. endif
  304. ifdef NO_NEWT
  305. NO_SLANG=1
  306. endif
  307. ifndef NO_SLANG
  308. ifneq ($(feature-libslang), 1)
  309. msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
  310. NO_SLANG := 1
  311. else
  312. # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
  313. CFLAGS += -I/usr/include/slang
  314. CFLAGS += -DHAVE_SLANG_SUPPORT
  315. EXTLIBS += -lslang
  316. endif
  317. endif
  318. ifndef NO_GTK2
  319. FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
  320. ifneq ($(feature-gtk2), 1)
  321. msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
  322. NO_GTK2 := 1
  323. else
  324. ifeq ($(feature-gtk2-infobar), 1)
  325. GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
  326. endif
  327. CFLAGS += -DHAVE_GTK2_SUPPORT
  328. GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
  329. GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
  330. EXTLIBS += -ldl
  331. endif
  332. endif
  333. grep-libs = $(filter -l%,$(1))
  334. strip-libs = $(filter-out -l%,$(1))
  335. ifdef NO_LIBPERL
  336. CFLAGS += -DNO_LIBPERL
  337. else
  338. PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
  339. PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
  340. PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
  341. PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
  342. FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
  343. ifneq ($(feature-libperl), 1)
  344. CFLAGS += -DNO_LIBPERL
  345. NO_LIBPERL := 1
  346. else
  347. LDFLAGS += $(PERL_EMBED_LDFLAGS)
  348. EXTLIBS += $(PERL_EMBED_LIBADD)
  349. endif
  350. endif
  351. ifeq ($(feature-timerfd), 1)
  352. CFLAGS += -DHAVE_TIMERFD_SUPPORT
  353. else
  354. msg := $(warning No timerfd support. Disables 'perf kvm stat live');
  355. endif
  356. disable-python = $(eval $(disable-python_code))
  357. define disable-python_code
  358. CFLAGS += -DNO_LIBPYTHON
  359. $(if $(1),$(warning No $(1) was found))
  360. $(warning Python support will not be built)
  361. NO_LIBPYTHON := 1
  362. endef
  363. override PYTHON := \
  364. $(call get-executable-or-default,PYTHON,python)
  365. ifndef PYTHON
  366. $(call disable-python,python interpreter)
  367. else
  368. PYTHON_WORD := $(call shell-wordify,$(PYTHON))
  369. ifdef NO_LIBPYTHON
  370. $(call disable-python)
  371. else
  372. override PYTHON_CONFIG := \
  373. $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
  374. ifndef PYTHON_CONFIG
  375. $(call disable-python,python-config tool)
  376. else
  377. PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
  378. PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
  379. PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
  380. PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
  381. PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
  382. FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
  383. ifneq ($(feature-libpython), 1)
  384. $(call disable-python,Python.h (for Python 2.x))
  385. else
  386. ifneq ($(feature-libpython-version), 1)
  387. $(warning Python 3 is not yet supported; please set)
  388. $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
  389. $(warning If you also have Python 2 installed, then)
  390. $(warning try something like:)
  391. $(warning $(and ,))
  392. $(warning $(and ,) make PYTHON=python2)
  393. $(warning $(and ,))
  394. $(warning Otherwise, disable Python support entirely:)
  395. $(warning $(and ,))
  396. $(warning $(and ,) make NO_LIBPYTHON=1)
  397. $(warning $(and ,))
  398. $(error $(and ,))
  399. else
  400. LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
  401. EXTLIBS += $(PYTHON_EMBED_LIBADD)
  402. LANG_BINDINGS += $(obj-perf)python/perf.so
  403. endif
  404. endif
  405. endif
  406. endif
  407. endif
  408. ifeq ($(feature-libbfd), 1)
  409. EXTLIBS += -lbfd
  410. endif
  411. ifdef NO_DEMANGLE
  412. CFLAGS += -DNO_DEMANGLE
  413. else
  414. ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
  415. EXTLIBS += -liberty
  416. CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
  417. else
  418. ifneq ($(feature-libbfd), 1)
  419. $(call feature_check,liberty)
  420. ifeq ($(feature-liberty), 1)
  421. EXTLIBS += -lbfd -liberty
  422. else
  423. $(call feature_check,liberty-z)
  424. ifeq ($(feature-liberty-z), 1)
  425. EXTLIBS += -lbfd -liberty -lz
  426. else
  427. $(call feature_check,cplus-demangle)
  428. ifeq ($(feature-cplus-demangle), 1)
  429. EXTLIBS += -liberty
  430. CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
  431. else
  432. msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
  433. CFLAGS += -DNO_DEMANGLE
  434. endif
  435. endif
  436. endif
  437. endif
  438. endif
  439. endif
  440. ifneq ($(filter -lbfd,$(EXTLIBS)),)
  441. CFLAGS += -DHAVE_LIBBFD_SUPPORT
  442. endif
  443. ifndef NO_ON_EXIT
  444. ifeq ($(feature-on-exit), 1)
  445. CFLAGS += -DHAVE_ON_EXIT_SUPPORT
  446. endif
  447. endif
  448. ifndef NO_BACKTRACE
  449. ifeq ($(feature-backtrace), 1)
  450. CFLAGS += -DHAVE_BACKTRACE_SUPPORT
  451. endif
  452. endif
  453. ifndef NO_LIBNUMA
  454. ifeq ($(feature-libnuma), 0)
  455. msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
  456. NO_LIBNUMA := 1
  457. else
  458. CFLAGS += -DHAVE_LIBNUMA_SUPPORT
  459. EXTLIBS += -lnuma
  460. endif
  461. endif
  462. # Among the variables below, these:
  463. # perfexecdir
  464. # template_dir
  465. # mandir
  466. # infodir
  467. # htmldir
  468. # ETC_PERFCONFIG (but not sysconfdir)
  469. # can be specified as a relative path some/where/else;
  470. # this is interpreted as relative to $(prefix) and "perf" at
  471. # runtime figures out where they are based on the path to the executable.
  472. # This can help installing the suite in a relocatable way.
  473. # Make the path relative to DESTDIR, not to prefix
  474. ifndef DESTDIR
  475. prefix = $(HOME)
  476. endif
  477. bindir_relative = bin
  478. bindir = $(prefix)/$(bindir_relative)
  479. mandir = share/man
  480. infodir = share/info
  481. perfexecdir = libexec/perf-core
  482. sharedir = $(prefix)/share
  483. template_dir = share/perf-core/templates
  484. htmldir = share/doc/perf-doc
  485. ifeq ($(prefix),/usr)
  486. sysconfdir = /etc
  487. ETC_PERFCONFIG = $(sysconfdir)/perfconfig
  488. else
  489. sysconfdir = $(prefix)/etc
  490. ETC_PERFCONFIG = etc/perfconfig
  491. endif
  492. ifeq ($(IS_X86_64),1)
  493. lib = lib64
  494. else
  495. lib = lib
  496. endif
  497. libdir = $(prefix)/$(lib)
  498. # Shell quote (do not use $(call) to accommodate ancient setups);
  499. ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
  500. DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
  501. bindir_SQ = $(subst ','\'',$(bindir))
  502. mandir_SQ = $(subst ','\'',$(mandir))
  503. infodir_SQ = $(subst ','\'',$(infodir))
  504. perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
  505. template_dir_SQ = $(subst ','\'',$(template_dir))
  506. htmldir_SQ = $(subst ','\'',$(htmldir))
  507. prefix_SQ = $(subst ','\'',$(prefix))
  508. sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
  509. libdir_SQ = $(subst ','\'',$(libdir))
  510. ifneq ($(filter /%,$(firstword $(perfexecdir))),)
  511. perfexec_instdir = $(perfexecdir)
  512. else
  513. perfexec_instdir = $(prefix)/$(perfexecdir)
  514. endif
  515. perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
  516. # If we install to $(HOME) we keep the traceevent default:
  517. # $(HOME)/.traceevent/plugins
  518. # Otherwise we install plugins into the global $(libdir).
  519. ifdef DESTDIR
  520. plugindir=$(libdir)/traceevent/plugins
  521. plugindir_SQ= $(subst ','\'',$(plugindir))
  522. endif