Makefile.perf 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. include ../scripts/Makefile.include
  2. # The default target of this Makefile is...
  3. all:
  4. include config/utilities.mak
  5. # Define V to have a more verbose compile.
  6. #
  7. # Define VF to have a more verbose feature check output.
  8. #
  9. # Define O to save output files in a separate directory.
  10. #
  11. # Define ARCH as name of target architecture if you want cross-builds.
  12. #
  13. # Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
  14. #
  15. # Define NO_LIBPERL to disable perl script extension.
  16. #
  17. # Define NO_LIBPYTHON to disable python script extension.
  18. #
  19. # Define PYTHON to point to the python binary if the default
  20. # `python' is not correct; for example: PYTHON=python2
  21. #
  22. # Define PYTHON_CONFIG to point to the python-config binary if
  23. # the default `$(PYTHON)-config' is not correct.
  24. #
  25. # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
  26. #
  27. # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
  28. #
  29. # Define LDFLAGS=-static to build a static binary.
  30. #
  31. # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
  32. #
  33. # Define NO_DWARF if you do not want debug-info analysis feature at all.
  34. #
  35. # Define WERROR=0 to disable treating any warnings as errors.
  36. #
  37. # Define NO_NEWT if you do not want TUI support. (deprecated)
  38. #
  39. # Define NO_SLANG if you do not want TUI support.
  40. #
  41. # Define NO_GTK2 if you do not want GTK+ GUI support.
  42. #
  43. # Define NO_DEMANGLE if you do not want C++ symbol demangling.
  44. #
  45. # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
  46. #
  47. # Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
  48. # backtrace post unwind.
  49. #
  50. # Define NO_BACKTRACE if you do not want stack backtrace debug feature
  51. #
  52. # Define NO_LIBNUMA if you do not want numa perf benchmark
  53. #
  54. # Define NO_LIBAUDIT if you do not want libaudit support
  55. #
  56. # Define NO_LIBBIONIC if you do not want bionic support
  57. #
  58. # Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
  59. # for dwarf backtrace post unwind.
  60. #
  61. # Define NO_PERF_READ_VDSO32 if you do not want to build perf-read-vdso32
  62. # for reading the 32-bit compatibility VDSO in 64-bit mode
  63. #
  64. # Define NO_PERF_READ_VDSOX32 if you do not want to build perf-read-vdsox32
  65. # for reading the x32 mode 32-bit compatibility VDSO in 64-bit mode
  66. #
  67. # Define NO_ZLIB if you do not want to support compressed kernel modules
  68. #
  69. # Define LIBBABELTRACE if you DO want libbabeltrace support
  70. # for CTF data format.
  71. #
  72. # Define NO_LZMA if you do not want to support compressed (xz) kernel modules
  73. #
  74. # Define NO_AUXTRACE if you do not want AUX area tracing support
  75. ifeq ($(srctree),)
  76. srctree := $(patsubst %/,%,$(dir $(shell pwd)))
  77. srctree := $(patsubst %/,%,$(dir $(srctree)))
  78. #$(info Determined 'srctree' to be $(srctree))
  79. endif
  80. ifneq ($(objtree),)
  81. #$(info Determined 'objtree' to be $(objtree))
  82. endif
  83. ifneq ($(OUTPUT),)
  84. #$(info Determined 'OUTPUT' to be $(OUTPUT))
  85. # Adding $(OUTPUT) as a directory to look for source files,
  86. # because use generated output files as sources dependency
  87. # for flex/bison parsers.
  88. VPATH += $(OUTPUT)
  89. export VPATH
  90. endif
  91. ifeq ($(V),1)
  92. Q =
  93. else
  94. Q = @
  95. endif
  96. # Do not use make's built-in rules
  97. # (this improves performance and avoids hard-to-debug behaviour);
  98. MAKEFLAGS += -r
  99. $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
  100. $(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
  101. $(Q)touch $(OUTPUT)PERF-VERSION-FILE
  102. CC = $(CROSS_COMPILE)gcc
  103. LD ?= $(CROSS_COMPILE)ld
  104. AR = $(CROSS_COMPILE)ar
  105. PKG_CONFIG = $(CROSS_COMPILE)pkg-config
  106. RM = rm -f
  107. LN = ln -f
  108. MKDIR = mkdir
  109. FIND = find
  110. INSTALL = install
  111. FLEX = flex
  112. BISON = bison
  113. STRIP = strip
  114. LIB_DIR = $(srctree)/tools/lib/api/
  115. TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
  116. # include config/Makefile by default and rule out
  117. # non-config cases
  118. config := 1
  119. NON_CONFIG_TARGETS := clean TAGS tags cscope help
  120. ifdef MAKECMDGOALS
  121. ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
  122. config := 0
  123. endif
  124. endif
  125. ifeq ($(config),1)
  126. include config/Makefile
  127. endif
  128. export prefix bindir sharedir sysconfdir DESTDIR
  129. # sparse is architecture-neutral, which means that we need to tell it
  130. # explicitly what architecture to check for. Fix this up for yours..
  131. SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
  132. # Guard against environment variables
  133. PYRF_OBJS =
  134. SCRIPT_SH =
  135. SCRIPT_SH += perf-archive.sh
  136. SCRIPT_SH += perf-with-kcore.sh
  137. grep-libs = $(filter -l%,$(1))
  138. strip-libs = $(filter-out -l%,$(1))
  139. ifneq ($(OUTPUT),)
  140. TE_PATH=$(OUTPUT)
  141. ifneq ($(subdir),)
  142. LIB_PATH=$(OUTPUT)/../lib/api/
  143. else
  144. LIB_PATH=$(OUTPUT)
  145. endif
  146. else
  147. TE_PATH=$(TRACE_EVENT_DIR)
  148. LIB_PATH=$(LIB_DIR)
  149. endif
  150. LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
  151. export LIBTRACEEVENT
  152. LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
  153. LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)
  154. LIBAPI = $(LIB_PATH)libapi.a
  155. export LIBAPI
  156. # python extension build directories
  157. PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/
  158. PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
  159. PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
  160. export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
  161. python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
  162. PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
  163. PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI)
  164. $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
  165. $(QUIET_GEN)CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
  166. $(PYTHON_WORD) util/setup.py \
  167. --quiet build_ext; \
  168. mkdir -p $(OUTPUT)python && \
  169. cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
  170. #
  171. # No Perl scripts right now:
  172. #
  173. SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
  174. PROGRAMS += $(OUTPUT)perf
  175. ifndef NO_PERF_READ_VDSO32
  176. PROGRAMS += $(OUTPUT)perf-read-vdso32
  177. endif
  178. ifndef NO_PERF_READ_VDSOX32
  179. PROGRAMS += $(OUTPUT)perf-read-vdsox32
  180. endif
  181. # what 'all' will build and 'install' will install, in perfexecdir
  182. ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
  183. # what 'all' will build but not install in perfexecdir
  184. OTHER_PROGRAMS = $(OUTPUT)perf
  185. # Set paths to tools early so that they can be used for version tests.
  186. ifndef SHELL_PATH
  187. SHELL_PATH = /bin/sh
  188. endif
  189. ifndef PERL_PATH
  190. PERL_PATH = /usr/bin/perl
  191. endif
  192. export PERL_PATH
  193. LIB_FILE=$(OUTPUT)libperf.a
  194. PERFLIBS = $(LIB_FILE) $(LIBAPI) $(LIBTRACEEVENT)
  195. # We choose to avoid "if .. else if .. else .. endif endif"
  196. # because maintaining the nesting to match is a pain. If
  197. # we had "elif" things would have been much nicer...
  198. -include arch/$(ARCH)/Makefile
  199. ifneq ($(OUTPUT),)
  200. CFLAGS += -I$(OUTPUT)
  201. endif
  202. ifndef NO_GTK2
  203. ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so
  204. GTK_IN := $(OUTPUT)gtk-in.o
  205. install-gtk: $(OUTPUT)libperf-gtk.so
  206. $(call QUIET_INSTALL, 'GTK UI') \
  207. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
  208. $(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
  209. endif
  210. ifdef ASCIIDOC8
  211. export ASCIIDOC8
  212. endif
  213. LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
  214. export INSTALL SHELL_PATH
  215. ### Build rules
  216. SHELL = $(SHELL_PATH)
  217. all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
  218. please_set_SHELL_PATH_to_a_more_modern_shell:
  219. $(Q)$$(:)
  220. shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
  221. strip: $(PROGRAMS) $(OUTPUT)perf
  222. $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
  223. PERF_IN := $(OUTPUT)perf-in.o
  224. export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX
  225. build := -f $(srctree)/tools/build/Makefile.build dir=. obj
  226. $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
  227. $(Q)$(MAKE) $(build)=perf
  228. $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)
  229. $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS) \
  230. $(PERF_IN) $(LIBS) -o $@
  231. $(GTK_IN): FORCE
  232. $(Q)$(MAKE) $(build)=gtk
  233. $(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
  234. $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
  235. $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
  236. $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
  237. $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
  238. $(SCRIPTS) : % : %.sh
  239. $(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
  240. # These can record PERF_VERSION
  241. perf.spec $(SCRIPTS) \
  242. : $(OUTPUT)PERF-VERSION-FILE
  243. .SUFFIXES:
  244. #
  245. # If a target does not match any of the later rules then prefix it by $(OUTPUT)
  246. # This makes targets like 'make O=/tmp/perf perf.o' work in a natural way.
  247. #
  248. ifneq ($(OUTPUT),)
  249. %.o: $(OUTPUT)%.o
  250. @echo " # Redirected target $@ => $(OUTPUT)$@"
  251. util/%.o: $(OUTPUT)util/%.o
  252. @echo " # Redirected target $@ => $(OUTPUT)$@"
  253. bench/%.o: $(OUTPUT)bench/%.o
  254. @echo " # Redirected target $@ => $(OUTPUT)$@"
  255. tests/%.o: $(OUTPUT)tests/%.o
  256. @echo " # Redirected target $@ => $(OUTPUT)$@"
  257. endif
  258. # These two need to be here so that when O= is not used they take precedence
  259. # over the general rule for .o
  260. # get relative building directory (to $(OUTPUT))
  261. # and '.' if it's $(OUTPUT) itself
  262. __build-dir = $(subst $(OUTPUT),,$(dir $@))
  263. build-dir = $(if $(__build-dir),$(__build-dir),.)
  264. single_dep: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
  265. $(OUTPUT)%.o: %.c single_dep FORCE
  266. $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
  267. $(OUTPUT)%.i: %.c single_dep FORCE
  268. $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
  269. $(OUTPUT)%.s: %.c single_dep FORCE
  270. $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
  271. $(OUTPUT)%-bison.o: %.c single_dep FORCE
  272. $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
  273. $(OUTPUT)%-flex.o: %.c single_dep FORCE
  274. $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
  275. $(OUTPUT)%.o: %.S single_dep FORCE
  276. $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
  277. $(OUTPUT)%.i: %.S single_dep FORCE
  278. $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
  279. $(OUTPUT)perf-%: %.o $(PERFLIBS)
  280. $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
  281. ifndef NO_PERF_READ_VDSO32
  282. $(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-vdso-map.c
  283. $(QUIET_CC)$(CC) -m32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
  284. endif
  285. ifndef NO_PERF_READ_VDSOX32
  286. $(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-vdso-map.c
  287. $(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
  288. endif
  289. $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
  290. LIBPERF_IN := $(OUTPUT)libperf-in.o
  291. $(LIBPERF_IN): FORCE
  292. $(Q)$(MAKE) $(build)=libperf
  293. $(LIB_FILE): $(LIBPERF_IN)
  294. $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(LIB_OBJS)
  295. LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
  296. $(LIBTRACEEVENT): FORCE
  297. $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a
  298. libtraceevent_plugins: FORCE
  299. $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins
  300. $(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins
  301. $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent-dynamic-list
  302. $(LIBTRACEEVENT)-clean:
  303. $(call QUIET_CLEAN, libtraceevent)
  304. $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null
  305. install-traceevent-plugins: $(LIBTRACEEVENT)
  306. $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins
  307. $(LIBAPI): FORCE
  308. $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a
  309. $(LIBAPI)-clean:
  310. $(call QUIET_CLEAN, libapi)
  311. $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
  312. help:
  313. @echo 'Perf make targets:'
  314. @echo ' doc - make *all* documentation (see below)'
  315. @echo ' man - make manpage documentation (access with man <foo>)'
  316. @echo ' html - make html documentation'
  317. @echo ' info - make GNU info documentation (access with info <foo>)'
  318. @echo ' pdf - make pdf documentation'
  319. @echo ' TAGS - use etags to make tag information for source browsing'
  320. @echo ' tags - use ctags to make tag information for source browsing'
  321. @echo ' cscope - use cscope to make interactive browsing database'
  322. @echo ''
  323. @echo 'Perf install targets:'
  324. @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
  325. @echo ' HINT: use "prefix" or "DESTDIR" to install to a particular'
  326. @echo ' path like "make prefix=/usr/local install install-doc"'
  327. @echo ' install - install compiled binaries'
  328. @echo ' install-doc - install *all* documentation'
  329. @echo ' install-man - install manpage documentation'
  330. @echo ' install-html - install html documentation'
  331. @echo ' install-info - install GNU info documentation'
  332. @echo ' install-pdf - install pdf documentation'
  333. @echo ''
  334. @echo ' quick-install-doc - alias for quick-install-man'
  335. @echo ' quick-install-man - install the documentation quickly'
  336. @echo ' quick-install-html - install the html documentation quickly'
  337. @echo ''
  338. @echo 'Perf maintainer targets:'
  339. @echo ' clean - clean all binary objects and build output'
  340. DOC_TARGETS := doc man html info pdf
  341. INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
  342. INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
  343. # 'make doc' should call 'make -C Documentation all'
  344. $(DOC_TARGETS):
  345. $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
  346. TAG_FOLDERS= . ../lib/traceevent ../lib/api ../lib/symbol
  347. TAG_FILES= ../../include/uapi/linux/perf_event.h
  348. TAGS:
  349. $(QUIET_GEN)$(RM) TAGS; \
  350. $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs etags -a $(TAG_FILES)
  351. tags:
  352. $(QUIET_GEN)$(RM) tags; \
  353. $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs ctags -a $(TAG_FILES)
  354. cscope:
  355. $(QUIET_GEN)$(RM) cscope*; \
  356. $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs cscope -b $(TAG_FILES)
  357. ### Testing rules
  358. # GNU make supports exporting all variables by "export" without parameters.
  359. # However, the environment gets quite big, and some programs have problems
  360. # with that.
  361. check: $(OUTPUT)common-cmds.h
  362. if sparse; \
  363. then \
  364. for i in *.c */*.c; \
  365. do \
  366. sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
  367. done; \
  368. else \
  369. exit 1; \
  370. fi
  371. ### Installation rules
  372. install-gtk:
  373. install-tools: all install-gtk
  374. $(call QUIET_INSTALL, binaries) \
  375. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'; \
  376. $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \
  377. $(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'
  378. ifndef NO_PERF_READ_VDSO32
  379. $(call QUIET_INSTALL, perf-read-vdso32) \
  380. $(INSTALL) $(OUTPUT)perf-read-vdso32 '$(DESTDIR_SQ)$(bindir_SQ)';
  381. endif
  382. ifndef NO_PERF_READ_VDSOX32
  383. $(call QUIET_INSTALL, perf-read-vdsox32) \
  384. $(INSTALL) $(OUTPUT)perf-read-vdsox32 '$(DESTDIR_SQ)$(bindir_SQ)';
  385. endif
  386. $(call QUIET_INSTALL, libexec) \
  387. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
  388. $(call QUIET_INSTALL, perf-archive) \
  389. $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
  390. $(call QUIET_INSTALL, perf-with-kcore) \
  391. $(INSTALL) $(OUTPUT)perf-with-kcore -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
  392. ifndef NO_LIBPERL
  393. $(call QUIET_INSTALL, perl-scripts) \
  394. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
  395. $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
  396. $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \
  397. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'; \
  398. $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
  399. endif
  400. ifndef NO_LIBPYTHON
  401. $(call QUIET_INSTALL, python-scripts) \
  402. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
  403. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'; \
  404. $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
  405. $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \
  406. $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
  407. endif
  408. $(call QUIET_INSTALL, perf_completion-script) \
  409. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \
  410. $(INSTALL) perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
  411. install-tests: all install-gtk
  412. $(call QUIET_INSTALL, tests) \
  413. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
  414. $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
  415. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \
  416. $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
  417. install-bin: install-tools install-tests
  418. install: install-bin try-install-man install-traceevent-plugins
  419. install-python_ext:
  420. $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
  421. # 'make install-doc' should call 'make -C Documentation install'
  422. $(INSTALL_DOC_TARGETS):
  423. $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=)
  424. ### Cleaning rules
  425. #
  426. # This is here, not in config/Makefile, because config/Makefile does
  427. # not get included for the clean target:
  428. #
  429. config-clean:
  430. $(call QUIET_CLEAN, config)
  431. $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null
  432. clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean
  433. $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
  434. $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
  435. $(Q)$(RM) $(OUTPUT).config-detected
  436. $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
  437. $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
  438. $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
  439. $(python-clean)
  440. #
  441. # Trick: if ../../.git does not exist - we are building out of tree for example,
  442. # then force version regeneration:
  443. #
  444. ifeq ($(wildcard ../../.git/HEAD),)
  445. GIT-HEAD-PHONY = ../../.git/HEAD
  446. else
  447. GIT-HEAD-PHONY =
  448. endif
  449. FORCE:
  450. .PHONY: all install clean config-clean strip install-gtk
  451. .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
  452. .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE single_dep
  453. .PHONY: libtraceevent_plugins