blob: 64c043b7a43848f17a023dcf9479dbd77f96d7be [file] [log] [blame]
Borislav Petkov98d89bf2012-04-11 18:36:14 +02001include ../scripts/Makefile.include
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -03002
Ingo Molnard24e4732009-04-20 13:32:07 +02003# The default target of this Makefile is...
Michael Wittena3d1ee12011-02-02 14:22:08 -06004all:
Ingo Molnare0143ba2009-03-23 21:29:59 +01005
Michael Wittenced465c2011-04-02 21:46:09 +00006include config/utilities.mak
7
Michael Wittena3d1ee12011-02-02 14:22:08 -06008# Define V to have a more verbose compile.
Ingo Molnard24e4732009-04-20 13:32:07 +02009#
Namhyung Kim67cbbd72012-02-23 16:08:14 +090010# Define O to save output files in a separate directory.
11#
12# Define ARCH as name of target architecture if you want cross-builds.
13#
14# Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
15#
16# Define NO_LIBPERL to disable perl script extension.
17#
18# Define NO_LIBPYTHON to disable python script extension.
19#
Michael Wittenced465c2011-04-02 21:46:09 +000020# Define PYTHON to point to the python binary if the default
21# `python' is not correct; for example: PYTHON=python2
22#
23# Define PYTHON_CONFIG to point to the python-config binary if
24# the default `$(PYTHON)-config' is not correct.
25#
Ingo Molnard24e4732009-04-20 13:32:07 +020026# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
27#
28# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
29#
Michael S. Tsirkin75138652009-10-29 17:20:02 +020030# Define LDFLAGS=-static to build a static binary.
Michael S. Tsirkin81516c52009-11-22 14:13:35 +020031#
32# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
Masami Hiramatsuca721e42010-03-22 13:10:27 -030033#
34# Define NO_DWARF if you do not want debug-info analysis feature at all.
Darren Hart9e59e092011-09-08 13:42:39 -070035#
36# Define WERROR=0 to disable treating any warnings as errors.
Namhyung Kim67cbbd72012-02-23 16:08:14 +090037#
Arnaldo Carvalho de Melo6692c262013-03-28 11:34:10 -030038# Define NO_NEWT if you do not want TUI support. (deprecated)
39#
40# Define NO_SLANG if you do not want TUI support.
Namhyung Kim67cbbd72012-02-23 16:08:14 +090041#
Namhyung Kim393be2e2012-08-06 13:41:21 +090042# Define NO_GTK2 if you do not want GTK+ GUI support.
43#
Namhyung Kim67cbbd72012-02-23 16:08:14 +090044# Define NO_DEMANGLE if you do not want C++ symbol demangling.
Namhyung Kim393be2e2012-08-06 13:41:21 +090045#
46# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
47#
Jiri Olsa6a40cd92012-08-07 15:20:44 +020048# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
49# backtrace post unwind.
Namhyung Kim4e34d952012-10-02 01:32:51 +090050#
51# Define NO_BACKTRACE if you do not want stack backtrace debug feature
Peter Hurley79d824e2013-01-27 20:51:22 -050052#
53# Define NO_LIBNUMA if you do not want numa perf benchmark
Jiri Olsa4e22db42013-05-24 14:35:24 +020054#
55# Define NO_LIBAUDIT if you do not want libaudit support
56#
57# Define NO_LIBBIONIC if you do not want bionic support
Ingo Molnare0143ba2009-03-23 21:29:59 +010058
Jiri Olsa362493f2013-03-25 00:40:48 +010059ifeq ($(srctree),)
60srctree := $(patsubst %/,%,$(dir $(shell pwd)))
61srctree := $(patsubst %/,%,$(dir $(srctree)))
62#$(info Determined 'srctree' to be $(srctree))
63endif
64
65ifneq ($(objtree),)
66#$(info Determined 'objtree' to be $(objtree))
67endif
68
69ifneq ($(OUTPUT),)
70#$(info Determined 'OUTPUT' to be $(OUTPUT))
71endif
72
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -030073$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
74 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
Ingo Molnare0143ba2009-03-23 21:29:59 +010075
Lin Ming174a7b1f2011-05-07 12:41:14 +080076CC = $(CROSS_COMPILE)gcc
77AR = $(CROSS_COMPILE)ar
78
Jiri Olsaa32f4932013-03-25 00:32:01 +010079RM = rm -f
80MKDIR = mkdir
81FIND = find
82INSTALL = install
83FLEX = flex
84BISON = bison
Jiri Olsa0dce60f2013-04-15 04:49:43 +020085STRIP = strip
Jiri Olsaa32f4932013-03-25 00:32:01 +010086
Jiri Olsa7c537462013-05-24 14:35:23 +020087LK_DIR = $(srctree)/tools/lib/lk/
88TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
Jiri Olsa362493f2013-03-25 00:40:48 +010089
Jiri Olsa8bd407b2013-03-15 16:28:49 +010090# include config/Makefile by default and rule out
91# non-config cases
92config := 1
93
94NON_CONFIG_TARGETS := clean TAGS tags cscope help
95
96ifdef MAKECMDGOALS
97ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
98 config := 0
Ian Munsiecd932c52010-04-20 16:58:32 +100099endif
Jiri Olsa8bd407b2013-03-15 16:28:49 +0100100endif
101
102ifeq ($(config),1)
103include config/Makefile
Ian Munsiecd932c52010-04-20 16:58:32 +1000104endif
105
Ingo Molnard24e4732009-04-20 13:32:07 +0200106export prefix bindir sharedir sysconfdir
107
Ingo Molnard24e4732009-04-20 13:32:07 +0200108# sparse is architecture-neutral, which means that we need to tell it
109# explicitly what architecture to check for. Fix this up for yours..
110SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
111
Ingo Molnard24e4732009-04-20 13:32:07 +0200112# Guard against environment variables
113BUILTIN_OBJS =
Ingo Molnard24e4732009-04-20 13:32:07 +0200114LIB_H =
115LIB_OBJS =
Arnaldo Carvalho de Melo877108e2011-01-29 15:44:29 -0200116PYRF_OBJS =
Ingo Molnard24e4732009-04-20 13:32:07 +0200117SCRIPT_SH =
Ingo Molnard24e4732009-04-20 13:32:07 +0200118
Arnaldo Carvalho de Melo2c585172010-01-15 13:17:52 -0200119SCRIPT_SH += perf-archive.sh
Ingo Molnar07800602009-04-20 15:00:56 +0200120
Tom Zanussif2481f32010-08-24 00:23:50 -0500121grep-libs = $(filter -l%,$(1))
122strip-libs = $(filter-out -l%,$(1))
123
Arnaldo Carvalho de Melo45bff412012-10-18 11:38:35 -0300124ifneq ($(OUTPUT),)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200125 TE_PATH=$(OUTPUT)
Borislav Petkov85c66be2013-02-20 16:32:30 +0100126ifneq ($(subdir),)
Robert Richterab4ecda2013-07-16 16:50:36 +0200127 LK_PATH=$(OUTPUT)/../lib/lk/
Borislav Petkov85c66be2013-02-20 16:32:30 +0100128else
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200129 LK_PATH=$(OUTPUT)
Borislav Petkov85c66be2013-02-20 16:32:30 +0100130endif
Arnaldo Carvalho de Melo45bff412012-10-18 11:38:35 -0300131else
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200132 TE_PATH=$(TRACE_EVENT_DIR)
Robert Richter107de372013-06-11 17:22:38 +0200133 LK_PATH=$(LK_DIR)
Arnaldo Carvalho de Melo45bff412012-10-18 11:38:35 -0300134endif
135
136LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
Namhyung Kim3cde41b2012-11-14 13:39:50 +0900137export LIBTRACEEVENT
138
Borislav Petkov85c66be2013-02-20 16:32:30 +0100139LIBLK = $(LK_PATH)liblk.a
140export LIBLK
141
Namhyung Kim3cde41b2012-11-14 13:39:50 +0900142# python extension build directories
143PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/
144PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
145PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
146export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
147
148python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
149
Namhyung Kim6a5c13af2012-02-12 19:45:24 +0900150PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
Jiri Olsac3c44702013-04-15 05:54:14 +0200151PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBLK)
Namhyung Kim6a5c13af2012-02-12 19:45:24 +0900152
Namhyung Kime4898332012-09-28 18:31:58 +0900153$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100154 $(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
Jiri Olsa9941c96a2011-07-22 13:33:07 +0200155 --quiet build_ext; \
156 mkdir -p $(OUTPUT)python && \
157 cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
Ingo Molnar07800602009-04-20 15:00:56 +0200158#
159# No Perl scripts right now:
160#
161
Michael Witten0a54fb62011-02-02 12:04:27 -0600162SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
Ingo Molnard24e4732009-04-20 13:32:07 +0200163
Ingo Molnar07800602009-04-20 15:00:56 +0200164#
Ingo Molnar125e7022009-04-20 16:13:46 +0200165# Single 'perf' binary right now:
Ingo Molnar07800602009-04-20 15:00:56 +0200166#
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300167PROGRAMS += $(OUTPUT)perf
Ingo Molnard24e4732009-04-20 13:32:07 +0200168
Ingo Molnar07800602009-04-20 15:00:56 +0200169# what 'all' will build and 'install' will install, in perfexecdir
Arnaldo Carvalho de Melo978f6262011-02-01 16:40:51 -0200170ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
Ingo Molnard24e4732009-04-20 13:32:07 +0200171
Ingo Molnar07800602009-04-20 15:00:56 +0200172# what 'all' will build but not install in perfexecdir
Michael Witten8796cb92011-02-02 11:57:41 -0600173OTHER_PROGRAMS = $(OUTPUT)perf
Ingo Molnard24e4732009-04-20 13:32:07 +0200174
175# Set paths to tools early so that they can be used for version tests.
176ifndef SHELL_PATH
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200177 SHELL_PATH = /bin/sh
Ingo Molnard24e4732009-04-20 13:32:07 +0200178endif
179ifndef PERL_PATH
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200180 PERL_PATH = /usr/bin/perl
Ingo Molnard24e4732009-04-20 13:32:07 +0200181endif
182
183export PERL_PATH
184
Eric Sandeene6048fb2012-09-20 21:31:44 -0500185$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
Jiri Olsa82ba1f22012-05-21 09:12:50 +0200186 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
Ingo Molnar65f3e562012-03-29 13:08:38 -0300187
Jiri Olsa024e6c92012-04-11 12:39:51 +0200188$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
Vinson Lee85df3b32013-02-13 13:48:58 -0800189 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
Ingo Molnar65f3e562012-03-29 13:08:38 -0300190
Eric Sandeene6048fb2012-09-20 21:31:44 -0500191$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
Ingo Molnar65f3e562012-03-29 13:08:38 -0300192 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
193
Jiri Olsa024e6c92012-04-11 12:39:51 +0200194$(OUTPUT)util/pmu-bison.c: util/pmu.y
Vinson Lee85df3b32013-02-13 13:48:58 -0800195 $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
Ingo Molnar65f3e562012-03-29 13:08:38 -0300196
Jiri Olsa024e6c92012-04-11 12:39:51 +0200197$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
198$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
Ingo Molnar65f3e562012-03-29 13:08:38 -0300199
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300200LIB_FILE=$(OUTPUT)libperf.a
Ingo Molnard24e4732009-04-20 13:32:07 +0200201
Ingo Molnar7d380c82012-10-14 10:40:57 +0200202LIB_H += ../../include/uapi/linux/perf_event.h
Arnaldo Carvalho de Melo43cbcd82009-07-01 12:28:37 -0300203LIB_H += ../../include/linux/rbtree.h
Arnaldo Carvalho de Melo5da50252009-07-01 14:46:08 -0300204LIB_H += ../../include/linux/list.h
Ingo Molnar7d380c82012-10-14 10:40:57 +0200205LIB_H += ../../include/uapi/linux/const.h
Hitoshi Mitake18e97e02010-01-30 20:43:24 +0900206LIB_H += ../../include/linux/hash.h
Masami Hiramatsu97698332009-10-16 20:08:18 -0400207LIB_H += ../../include/linux/stringify.h
Arnaldo Carvalho de Melo79b9ad32009-10-19 15:31:31 -0200208LIB_H += util/include/linux/bitmap.h
209LIB_H += util/include/linux/bitops.h
210LIB_H += util/include/linux/compiler.h
Arnaldo Carvalho de Melo75911c92011-05-26 10:13:38 -0300211LIB_H += util/include/linux/const.h
Arnaldo Carvalho de Melo79b9ad32009-10-19 15:31:31 -0200212LIB_H += util/include/linux/ctype.h
213LIB_H += util/include/linux/kernel.h
Arnaldo Carvalho de Melo5da50252009-07-01 14:46:08 -0300214LIB_H += util/include/linux/list.h
Jiri Olsa2c86bf12012-03-26 11:17:05 +0200215LIB_H += util/include/linux/export.h
Irina Tirdeaf8fcd772012-09-11 01:14:58 +0300216LIB_H += util/include/linux/magic.h
Arnaldo Carvalho de Melo79b9ad32009-10-19 15:31:31 -0200217LIB_H += util/include/linux/poison.h
218LIB_H += util/include/linux/prefetch.h
219LIB_H += util/include/linux/rbtree.h
Markus Trippelsdorf871a0592012-10-09 20:01:56 +0200220LIB_H += util/include/linux/rbtree_augmented.h
Arnaldo Carvalho de Melo20639c12009-10-19 15:11:36 -0200221LIB_H += util/include/linux/string.h
Arnaldo Carvalho de Melo79b9ad32009-10-19 15:31:31 -0200222LIB_H += util/include/linux/types.h
Hitoshi Mitakeea7872b2010-11-25 16:04:53 +0900223LIB_H += util/include/linux/linkage.h
Arnaldo Carvalho de Melo79b9ad32009-10-19 15:31:31 -0200224LIB_H += util/include/asm/asm-offsets.h
Arnaldo Carvalho de Melo049ae802009-12-27 21:36:58 -0200225LIB_H += util/include/asm/bug.h
Arnaldo Carvalho de Melo79b9ad32009-10-19 15:31:31 -0200226LIB_H += util/include/asm/byteorder.h
Arnaldo Carvalho de Melofb720142010-04-30 19:31:12 -0300227LIB_H += util/include/asm/hweight.h
Arnaldo Carvalho de Melo79b9ad32009-10-19 15:31:31 -0200228LIB_H += util/include/asm/swab.h
229LIB_H += util/include/asm/system.h
Arnaldo Carvalho de Melo79b9ad32009-10-19 15:31:31 -0200230LIB_H += util/include/asm/uaccess.h
Ian Munsiecd932c52010-04-20 16:58:32 +1000231LIB_H += util/include/dwarf-regs.h
Hitoshi Mitakeea7872b2010-11-25 16:04:53 +0900232LIB_H += util/include/asm/dwarf2.h
233LIB_H += util/include/asm/cpufeature.h
Ingo Molnareae7a752012-03-14 12:42:34 -0300234LIB_H += util/include/asm/unistd_32.h
235LIB_H += util/include/asm/unistd_64.h
Thomas Gleixner6eda5832009-05-01 18:29:57 +0200236LIB_H += perf.h
Arnaldo Carvalho de Melo78f7def2011-02-04 09:45:46 -0200237LIB_H += util/annotate.h
Arnaldo Carvalho de Melo049ae802009-12-27 21:36:58 -0200238LIB_H += util/cache.h
239LIB_H += util/callchain.h
Arnaldo Carvalho de Melo7b2567c2010-02-03 16:52:04 -0200240LIB_H += util/build-id.h
Arnaldo Carvalho de Melo049ae802009-12-27 21:36:58 -0200241LIB_H += util/debug.h
Jiri Olsae90fda02012-01-27 15:34:22 +0100242LIB_H += util/sysfs.h
Jiri Olsacd82a322012-03-15 20:09:17 +0100243LIB_H += util/pmu.h
Arnaldo Carvalho de Meloec218fc2009-10-03 20:30:48 -0300244LIB_H += util/event.h
Arnaldo Carvalho de Melo69aad6f2011-01-03 16:39:04 -0200245LIB_H += util/evsel.h
Arnaldo Carvalho de Melo361c99a2011-01-11 20:56:53 -0200246LIB_H += util/evlist.h
Arnaldo Carvalho de Melo049ae802009-12-27 21:36:58 -0200247LIB_H += util/exec_cmd.h
Peter Zijlstra7c6a1c62009-06-25 17:05:54 +0200248LIB_H += util/types.h
Ingo Molnar148be2c2009-04-27 08:02:14 +0200249LIB_H += util/levenshtein.h
Arnaldo Carvalho de Melo9d2f8e22012-10-06 15:43:20 -0300250LIB_H += util/machine.h
Arnaldo Carvalho de Melo4a58e612009-12-27 21:37:00 -0200251LIB_H += util/map.h
Ingo Molnar148be2c2009-04-27 08:02:14 +0200252LIB_H += util/parse-options.h
Ingo Molnar8ad8db32009-05-26 11:10:09 +0200253LIB_H += util/parse-events.h
Ingo Molnar148be2c2009-04-27 08:02:14 +0200254LIB_H += util/quote.h
255LIB_H += util/util.h
Arnaldo Carvalho de Melo69aad6f2011-01-03 16:39:04 -0200256LIB_H += util/xyarray.h
Arnaldo Carvalho de Melo94c744b2009-12-11 21:24:02 -0200257LIB_H += util/header.h
Ingo Molnar148be2c2009-04-27 08:02:14 +0200258LIB_H += util/help.h
Arnaldo Carvalho de Melo94c744b2009-12-11 21:24:02 -0200259LIB_H += util/session.h
Ingo Molnar148be2c2009-04-27 08:02:14 +0200260LIB_H += util/strbuf.h
Arnaldo Carvalho de Melo25903402009-06-30 19:01:20 -0300261LIB_H += util/strlist.h
Masami Hiramatsu68baa432011-01-20 23:15:30 +0900262LIB_H += util/strfilter.h
Arnaldo Carvalho de Melo049ae802009-12-27 21:36:58 -0200263LIB_H += util/svghelper.h
Arnaldo Carvalho de Melo45694aa2011-11-28 08:30:20 -0200264LIB_H += util/tool.h
Ingo Molnar148be2c2009-04-27 08:02:14 +0200265LIB_H += util/run-command.h
Ingo Molnara930d2c2009-05-27 09:50:13 +0200266LIB_H += util/sigchain.h
Jiri Olsacdd059d2012-10-27 23:18:32 +0200267LIB_H += util/dso.h
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -0300268LIB_H += util/symbol.h
Ingo Molnar8fc03212009-06-04 15:19:47 +0200269LIB_H += util/color.h
Brice Goglin8d513272009-08-07 13:55:24 +0200270LIB_H += util/values.h
John Kacurdd68ada2009-09-24 18:02:49 +0200271LIB_H += util/sort.h
John Kacur3d1d07e2009-09-28 15:32:55 +0200272LIB_H += util/hist.h
Arnaldo Carvalho de Melo1b46cdd2009-09-28 14:48:46 -0300273LIB_H += util/thread.h
Arnaldo Carvalho de Melofd782602011-01-18 15:15:24 -0200274LIB_H += util/thread_map.h
Arnaldo Carvalho de Melo049ae802009-12-27 21:36:58 -0200275LIB_H += util/trace-event.h
Masami Hiramatsu57d250d2009-11-30 19:19:34 -0500276LIB_H += util/probe-finder.h
Masami Hiramatsue0d153c2011-06-27 16:27:27 +0900277LIB_H += util/dwarf-aux.h
Masami Hiramatsu50656ee2009-11-30 19:19:58 -0500278LIB_H += util/probe-event.h
Arnaldo Carvalho de Melo3e1bbdc32010-05-14 20:05:21 -0300279LIB_H += util/pstack.h
Paul Mackerrasa12b51c2010-03-10 20:36:09 +1100280LIB_H += util/cpumap.h
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -0200281LIB_H += util/top.h
Hitoshi Mitakeea7872b2010-11-25 16:04:53 +0900282LIB_H += $(ARCH_INCLUDE)
Stephane Eranian023695d2011-02-14 11:20:01 +0200283LIB_H += util/cgroup.h
Robert Richter4e319022013-06-11 17:29:18 +0200284LIB_H += $(LIB_INCLUDE)traceevent/event-parse.h
Namhyung Kim12864b32012-04-26 14:15:22 +0900285LIB_H += util/target.h
David Ahern37bbd3f2012-07-30 22:31:32 -0600286LIB_H += util/rblist.h
David Ahern70b40c42012-07-30 22:31:34 -0600287LIB_H += util/intlist.h
Jiri Olsa2bcd3552012-08-07 15:20:43 +0200288LIB_H += util/perf_regs.h
Jiri Olsa71ad0f52012-08-07 15:20:46 +0200289LIB_H += util/unwind.h
Jiri Olsa7dbf4dc2012-09-10 18:50:19 +0200290LIB_H += util/vdso.h
Namhyung Kim75291422012-11-15 01:47:40 +0900291LIB_H += ui/helpline.h
292LIB_H += ui/progress.h
293LIB_H += ui/util.h
294LIB_H += ui/ui.h
Ingo Molnard24e4732009-04-20 13:32:07 +0200295
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300296LIB_OBJS += $(OUTPUT)util/abspath.o
297LIB_OBJS += $(OUTPUT)util/alias.o
Arnaldo Carvalho de Melo78f7def2011-02-04 09:45:46 -0200298LIB_OBJS += $(OUTPUT)util/annotate.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300299LIB_OBJS += $(OUTPUT)util/build-id.o
300LIB_OBJS += $(OUTPUT)util/config.o
301LIB_OBJS += $(OUTPUT)util/ctype.o
Jiri Olsae90fda02012-01-27 15:34:22 +0100302LIB_OBJS += $(OUTPUT)util/sysfs.o
Jiri Olsacd82a322012-03-15 20:09:17 +0100303LIB_OBJS += $(OUTPUT)util/pmu.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300304LIB_OBJS += $(OUTPUT)util/environment.o
305LIB_OBJS += $(OUTPUT)util/event.o
Arnaldo Carvalho de Melo361c99a2011-01-11 20:56:53 -0200306LIB_OBJS += $(OUTPUT)util/evlist.o
Arnaldo Carvalho de Melo69aad6f2011-01-03 16:39:04 -0200307LIB_OBJS += $(OUTPUT)util/evsel.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300308LIB_OBJS += $(OUTPUT)util/exec_cmd.o
309LIB_OBJS += $(OUTPUT)util/help.o
310LIB_OBJS += $(OUTPUT)util/levenshtein.o
311LIB_OBJS += $(OUTPUT)util/parse-options.o
312LIB_OBJS += $(OUTPUT)util/parse-events.o
313LIB_OBJS += $(OUTPUT)util/path.o
314LIB_OBJS += $(OUTPUT)util/rbtree.o
315LIB_OBJS += $(OUTPUT)util/bitmap.o
316LIB_OBJS += $(OUTPUT)util/hweight.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300317LIB_OBJS += $(OUTPUT)util/run-command.o
318LIB_OBJS += $(OUTPUT)util/quote.o
319LIB_OBJS += $(OUTPUT)util/strbuf.o
320LIB_OBJS += $(OUTPUT)util/string.o
321LIB_OBJS += $(OUTPUT)util/strlist.o
Masami Hiramatsu68baa432011-01-20 23:15:30 +0900322LIB_OBJS += $(OUTPUT)util/strfilter.o
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -0200323LIB_OBJS += $(OUTPUT)util/top.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300324LIB_OBJS += $(OUTPUT)util/usage.o
325LIB_OBJS += $(OUTPUT)util/wrapper.o
326LIB_OBJS += $(OUTPUT)util/sigchain.o
Jiri Olsacdd059d2012-10-27 23:18:32 +0200327LIB_OBJS += $(OUTPUT)util/dso.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300328LIB_OBJS += $(OUTPUT)util/symbol.o
Namhyung Kime5a18452012-08-06 13:41:20 +0900329LIB_OBJS += $(OUTPUT)util/symbol-elf.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300330LIB_OBJS += $(OUTPUT)util/color.o
331LIB_OBJS += $(OUTPUT)util/pager.o
332LIB_OBJS += $(OUTPUT)util/header.o
333LIB_OBJS += $(OUTPUT)util/callchain.o
334LIB_OBJS += $(OUTPUT)util/values.o
335LIB_OBJS += $(OUTPUT)util/debug.o
Arnaldo Carvalho de Melo9d2f8e22012-10-06 15:43:20 -0300336LIB_OBJS += $(OUTPUT)util/machine.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300337LIB_OBJS += $(OUTPUT)util/map.o
Arnaldo Carvalho de Melo3e1bbdc32010-05-14 20:05:21 -0300338LIB_OBJS += $(OUTPUT)util/pstack.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300339LIB_OBJS += $(OUTPUT)util/session.o
340LIB_OBJS += $(OUTPUT)util/thread.o
Arnaldo Carvalho de Melofd782602011-01-18 15:15:24 -0200341LIB_OBJS += $(OUTPUT)util/thread_map.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300342LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
Jiri Olsa89812fc2012-03-15 20:09:15 +0100343LIB_OBJS += $(OUTPUT)util/parse-events-flex.o
344LIB_OBJS += $(OUTPUT)util/parse-events-bison.o
Jiri Olsacd82a322012-03-15 20:09:17 +0100345LIB_OBJS += $(OUTPUT)util/pmu-flex.o
346LIB_OBJS += $(OUTPUT)util/pmu-bison.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300347LIB_OBJS += $(OUTPUT)util/trace-event-read.o
348LIB_OBJS += $(OUTPUT)util/trace-event-info.o
349LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
350LIB_OBJS += $(OUTPUT)util/svghelper.o
351LIB_OBJS += $(OUTPUT)util/sort.o
352LIB_OBJS += $(OUTPUT)util/hist.o
353LIB_OBJS += $(OUTPUT)util/probe-event.o
354LIB_OBJS += $(OUTPUT)util/util.o
Arnaldo Carvalho de Melo69aad6f2011-01-03 16:39:04 -0200355LIB_OBJS += $(OUTPUT)util/xyarray.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300356LIB_OBJS += $(OUTPUT)util/cpumap.o
Stephane Eranian023695d2011-02-14 11:20:01 +0200357LIB_OBJS += $(OUTPUT)util/cgroup.o
Namhyung Kim12864b32012-04-26 14:15:22 +0900358LIB_OBJS += $(OUTPUT)util/target.o
David Ahern37bbd3f2012-07-30 22:31:32 -0600359LIB_OBJS += $(OUTPUT)util/rblist.o
David Ahern70b40c42012-07-30 22:31:34 -0600360LIB_OBJS += $(OUTPUT)util/intlist.o
Jiri Olsa7dbf4dc2012-09-10 18:50:19 +0200361LIB_OBJS += $(OUTPUT)util/vdso.o
Xiao Guangrong0007ece2012-09-17 16:31:14 +0800362LIB_OBJS += $(OUTPUT)util/stat.o
Adrian Hunterfaf96702013-08-27 11:23:08 +0300363LIB_OBJS += $(OUTPUT)util/record.o
Namhyung Kimea251d52012-09-03 11:53:06 +0900364
Namhyung Kim59ed16b2012-11-13 22:30:35 +0900365LIB_OBJS += $(OUTPUT)ui/setup.o
Namhyung Kime6e90462012-08-16 17:14:50 +0900366LIB_OBJS += $(OUTPUT)ui/helpline.o
Namhyung Kim688f2f52012-11-13 22:30:32 +0900367LIB_OBJS += $(OUTPUT)ui/progress.o
Namhyung Kim75291422012-11-15 01:47:40 +0900368LIB_OBJS += $(OUTPUT)ui/util.o
Namhyung Kimea251d52012-09-03 11:53:06 +0900369LIB_OBJS += $(OUTPUT)ui/hist.o
Namhyung Kim7ccf4f92012-08-20 13:52:05 +0900370LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
Ingo Molnard24e4732009-04-20 13:32:07 +0200371
Irina Tirdea68e94f42012-10-16 02:33:38 +0300372LIB_OBJS += $(OUTPUT)arch/common.o
373
Jiri Olsa945aea22012-10-30 23:01:43 +0100374LIB_OBJS += $(OUTPUT)tests/parse-events.o
375LIB_OBJS += $(OUTPUT)tests/dso-data.o
Jiri Olsa52502bf2012-10-31 15:52:47 +0100376LIB_OBJS += $(OUTPUT)tests/attr.o
Jiri Olsa0a4e1ae2012-11-10 01:46:41 +0100377LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
Jiri Olsad3b59a32012-11-10 01:46:42 +0100378LIB_OBJS += $(OUTPUT)tests/open-syscall.o
Jiri Olsabd905172012-11-10 01:46:43 +0100379LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
Jiri Olsadc447ee2012-11-10 01:46:49 +0100380LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o
Jiri Olsaa65b9c62012-11-10 01:46:44 +0100381LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
Jiri Olsa16d00fe2012-11-10 01:46:45 +0100382LIB_OBJS += $(OUTPUT)tests/perf-record.o
Jiri Olsabacf7e52012-11-10 01:46:46 +0100383LIB_OBJS += $(OUTPUT)tests/rdpmc.o
Jiri Olsacfffae22012-11-10 01:46:47 +0100384LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
Jiri Olsa5e24a092012-11-10 01:46:48 +0100385LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
Jiri Olsacff7f952012-11-10 01:46:50 +0100386LIB_OBJS += $(OUTPUT)tests/pmu.o
Namhyung Kimf8ebb0c2012-12-10 17:29:57 +0900387LIB_OBJS += $(OUTPUT)tests/hists_link.o
Arnaldo Carvalho de Melo54359d32012-12-14 13:06:13 -0300388LIB_OBJS += $(OUTPUT)tests/python-use.o
Jiri Olsa5a6bef42013-03-10 19:41:10 +0100389LIB_OBJS += $(OUTPUT)tests/bp_signal.o
Jiri Olsa06933e32013-03-10 19:41:11 +0100390LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o
Namhyung Kimd723a552013-03-15 14:58:11 +0900391LIB_OBJS += $(OUTPUT)tests/task-exit.o
Namhyung Kimbc96b362013-03-18 11:41:47 +0900392LIB_OBJS += $(OUTPUT)tests/sw-clock.o
Adrian Hunter3bd5a5f2013-06-28 16:22:19 +0300393ifeq ($(ARCH),x86)
394LIB_OBJS += $(OUTPUT)tests/perf-time-to-tsc.o
395endif
Adrian Hunterb55ae0a2013-08-07 14:38:45 +0300396LIB_OBJS += $(OUTPUT)tests/code-reading.o
Adrian Hunter53a277e2013-09-04 23:18:16 +0300397LIB_OBJS += $(OUTPUT)tests/sample-parsing.o
398LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o
Jiri Olsa945aea22012-10-30 23:01:43 +0100399
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300400BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300401BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
Hitoshi Mitakebfde82e2009-11-05 09:31:37 +0900402# Benchmark modules
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300403BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
404BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
Hitoshi Mitakeea7872b2010-11-25 16:04:53 +0900405ifeq ($(RAW_ARCH),x86_64)
406BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
Jan Beulichbe3de802012-01-24 10:03:22 -0200407BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
Hitoshi Mitakeea7872b2010-11-25 16:04:53 +0900408endif
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300409BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
Jan Beulichbe3de802012-01-24 10:03:22 -0200410BUILTIN_OBJS += $(OUTPUT)bench/mem-memset.o
Hitoshi Mitakebfde82e2009-11-05 09:31:37 +0900411
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300412BUILTIN_OBJS += $(OUTPUT)builtin-diff.o
Arnaldo Carvalho de Melo43adec92011-03-15 11:04:13 -0300413BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300414BUILTIN_OBJS += $(OUTPUT)builtin-help.o
415BUILTIN_OBJS += $(OUTPUT)builtin-sched.o
416BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o
417BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o
418BUILTIN_OBJS += $(OUTPUT)builtin-list.o
419BUILTIN_OBJS += $(OUTPUT)builtin-record.o
420BUILTIN_OBJS += $(OUTPUT)builtin-report.o
421BUILTIN_OBJS += $(OUTPUT)builtin-stat.o
422BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o
423BUILTIN_OBJS += $(OUTPUT)builtin-top.o
Ingo Molnar133dc4c2010-11-16 18:45:39 +0100424BUILTIN_OBJS += $(OUTPUT)builtin-script.o
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300425BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
426BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
427BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
Zhang, Yanmina1645ce2010-04-19 13:32:50 +0800428BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
Tom Zanussi454c4072010-05-01 01:41:20 -0500429BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
Jiri Olsa945aea22012-10-30 23:01:43 +0100430BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
Stephane Eranian028f12e2013-01-24 16:10:38 +0100431BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
Ingo Molnard24e4732009-04-20 13:32:07 +0200432
Borislav Petkov85c66be2013-02-20 16:32:30 +0100433PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT)
Ingo Molnard24e4732009-04-20 13:32:07 +0200434
Ingo Molnard24e4732009-04-20 13:32:07 +0200435# We choose to avoid "if .. else if .. else .. endif endif"
436# because maintaining the nesting to match is a pain. If
437# we had "elif" things would have been much nicer...
438
Ian Munsiecd932c52010-04-20 16:58:32 +1000439-include arch/$(ARCH)/Makefile
440
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300441ifneq ($(OUTPUT),)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200442 CFLAGS += -I$(OUTPUT)
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300443endif
444
Namhyung Kim393be2e2012-08-06 13:41:21 +0900445ifdef NO_LIBELF
Namhyung Kim393be2e2012-08-06 13:41:21 +0900446EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
447
448# Remove ELF/DWARF dependent codes
449LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
450LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
451LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
452LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS))
453
454BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
455
456# Use minimal symbol handling
457LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
458
459else # NO_LIBELF
Masami Hiramatsuca721e42010-03-22 13:10:27 -0300460ifndef NO_DWARF
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200461 LIB_OBJS += $(OUTPUT)util/probe-finder.o
462 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
Ian Munsiecd932c52010-04-20 16:58:32 +1000463endif # NO_DWARF
Namhyung Kim393be2e2012-08-06 13:41:21 +0900464endif # NO_LIBELF
Masami Hiramatsu4ea42b12009-10-08 17:17:38 -0400465
Namhyung Kim95485b12012-09-28 18:32:00 +0900466ifndef NO_LIBUNWIND
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200467 LIB_OBJS += $(OUTPUT)util/unwind.o
Jiri Olsa6a40cd92012-08-07 15:20:44 +0200468endif
Adrian Hunter395c3072013-08-31 21:50:53 +0300469LIB_OBJS += $(OUTPUT)tests/keep-tracking.o
Jiri Olsa6a40cd92012-08-07 15:20:44 +0200470
Namhyung Kimf315e162012-09-28 18:32:01 +0900471ifndef NO_LIBAUDIT
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200472 BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
Namhyung Kim4d290892012-09-27 20:23:38 +0900473endif
474
Arnaldo Carvalho de Melo6692c262013-03-28 11:34:10 -0300475ifndef NO_SLANG
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200476 LIB_OBJS += $(OUTPUT)ui/browser.o
477 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
478 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
479 LIB_OBJS += $(OUTPUT)ui/browsers/map.o
480 LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
481 LIB_OBJS += $(OUTPUT)ui/tui/setup.o
482 LIB_OBJS += $(OUTPUT)ui/tui/util.o
483 LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
484 LIB_OBJS += $(OUTPUT)ui/tui/progress.o
485 LIB_H += ui/browser.h
486 LIB_H += ui/browsers/map.h
487 LIB_H += ui/keysyms.h
488 LIB_H += ui/libslang.h
Jamie Ilescc835752009-12-11 09:21:00 +0000489endif
Tom Zanussi16c632d2009-11-25 01:15:48 -0600490
Namhyung Kimf9f526e2012-09-28 18:32:03 +0900491ifndef NO_GTK2
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200492 LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
493 LIB_OBJS += $(OUTPUT)ui/gtk/hists.o
494 LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
495 LIB_OBJS += $(OUTPUT)ui/gtk/util.o
496 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
497 LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
498 LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o
Pekka Enbergc31a9452012-03-19 15:13:29 -0300499endif
500
Jiri Olsa3082cb32013-03-18 00:19:44 +0100501ifndef NO_LIBPERL
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200502 LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
503 LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
Tom Zanussi16c632d2009-11-25 01:15:48 -0600504endif
505
Jiri Olsa6e533cf2013-03-18 00:35:32 +0100506ifndef NO_LIBPYTHON
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200507 LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
508 LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
Tom Zanussi7e4b21b2010-01-27 02:27:57 -0600509endif
510
Jiri Olsa2bcd3552012-08-07 15:20:43 +0200511ifeq ($(NO_PERF_REGS),0)
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200512 ifeq ($(ARCH),x86)
513 LIB_H += arch/x86/include/perf_regs.h
514 endif
Jiri Olsa2bcd3552012-08-07 15:20:43 +0200515endif
Kirill A. Shutemovf4e7ac02010-08-21 03:38:20 +0300516
Peter Hurley79d824e2013-01-27 20:51:22 -0500517ifndef NO_LIBNUMA
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200518 BUILTIN_OBJS += $(OUTPUT)bench/numa.o
Peter Hurley79d824e2013-01-27 20:51:22 -0500519endif
520
Ingo Molnard24e4732009-04-20 13:32:07 +0200521ifdef ASCIIDOC8
Jiri Olsa8e1b3f62013-04-15 04:06:58 +0200522 export ASCIIDOC8
Ingo Molnard24e4732009-04-20 13:32:07 +0200523endif
524
Mathias Krause203db292011-06-15 23:03:38 +0200525LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
Ingo Molnard24e4732009-04-20 13:32:07 +0200526
Michael Wittena3d1ee12011-02-02 14:22:08 -0600527export INSTALL SHELL_PATH
Ingo Molnard24e4732009-04-20 13:32:07 +0200528
Ingo Molnard24e4732009-04-20 13:32:07 +0200529### Build rules
530
531SHELL = $(SHELL_PATH)
532
Michael Wittena3d1ee12011-02-02 14:22:08 -0600533all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
Ingo Molnard24e4732009-04-20 13:32:07 +0200534
535please_set_SHELL_PATH_to_a_more_modern_shell:
536 @$$(:)
537
538shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
539
Michael Witten8796cb92011-02-02 11:57:41 -0600540strip: $(PROGRAMS) $(OUTPUT)perf
541 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
Ingo Molnard24e4732009-04-20 13:32:07 +0200542
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300543$(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
Namhyung Kim3cecaa22013-01-16 20:59:53 +0900544 $(QUIET_CC)$(CC) -include $(OUTPUT)PERF-VERSION-FILE \
Ingo Molnar07800602009-04-20 15:00:56 +0200545 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100546 $(CFLAGS) -c $(filter %.c,$^) -o $@
Ingo Molnard24e4732009-04-20 13:32:07 +0200547
Michael Witten8796cb92011-02-02 11:57:41 -0600548$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
Jiri Olsa1e9f7aa2013-03-21 11:41:05 +0100549 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \
Tom Zanussif2481f32010-08-24 00:23:50 -0500550 $(BUILTIN_OBJS) $(LIBS) -o $@
Ingo Molnard24e4732009-04-20 13:32:07 +0200551
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300552$(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100553 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
Ingo Molnar07800602009-04-20 15:00:56 +0200554 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
555 '-DPERF_MAN_PATH="$(mandir_SQ)"' \
556 '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
Ingo Molnard24e4732009-04-20 13:32:07 +0200557
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300558$(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100559 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
Arjan van de Ven10274982009-09-12 07:53:05 +0200560 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
561 '-DPERF_MAN_PATH="$(mandir_SQ)"' \
562 '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
563
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300564$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
Ingo Molnard24e4732009-04-20 13:32:07 +0200565
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300566$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
Mulyadi Santosa1ad05602009-09-26 02:01:41 +0700567 $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
Ingo Molnard24e4732009-04-20 13:32:07 +0200568
Michael Wittena3d1ee12011-02-02 14:22:08 -0600569$(SCRIPTS) : % : %.sh
570 $(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
Ingo Molnard24e4732009-04-20 13:32:07 +0200571
Ingo Molnar07800602009-04-20 15:00:56 +0200572# These can record PERF_VERSION
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300573$(OUTPUT)perf.o perf.spec \
Michael Wittena3d1ee12011-02-02 14:22:08 -0600574 $(SCRIPTS) \
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300575 : $(OUTPUT)PERF-VERSION-FILE
Ingo Molnard24e4732009-04-20 13:32:07 +0200576
Jiri Olsa89812fc2012-03-15 20:09:15 +0100577.SUFFIXES:
578.SUFFIXES: .o .c .S .s
579
Ingo Molnar65f3e562012-03-29 13:08:38 -0300580# These two need to be here so that when O= is not used they take precedence
581# over the general rule for .o
582
583$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100584 $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -w $<
Ingo Molnar65f3e562012-03-29 13:08:38 -0300585
586$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100587 $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
Ingo Molnar65f3e562012-03-29 13:08:38 -0300588
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300589$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100590 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
Jan Beulich4a3d2d92012-03-08 09:29:28 +0000591$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100592 $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300593$(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100594 $(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $<
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300595$(OUTPUT)%.o: %.S
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100596 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
Jan Beulich4a3d2d92012-03-08 09:29:28 +0000597$(OUTPUT)%.s: %.S
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100598 $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
Ingo Molnard24e4732009-04-20 13:32:07 +0200599
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300600$(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100601 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
Ingo Molnar07800602009-04-20 15:00:56 +0200602 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
Ingo Molnard24e4732009-04-20 13:32:07 +0200603 '-DPREFIX="$(prefix_SQ)"' \
604 $<
605
Jiri Olsad898b242012-10-30 23:02:05 +0100606$(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100607 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
Namhyung Kim000ae332012-12-17 16:25:01 +0900608 '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \
Jiri Olsad898b242012-10-30 23:02:05 +0100609 $<
610
Arnaldo Carvalho de Melo54359d32012-12-14 13:06:13 -0300611$(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100612 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
Jiri Olsa09ecbb02012-12-19 09:52:21 +0100613 -DPYTHONPATH='"$(OUTPUT)python"' \
Namhyung Kim000ae332012-12-17 16:25:01 +0900614 -DPYTHON='"$(PYTHON_WORD)"' \
615 $<
Arnaldo Carvalho de Melo54359d32012-12-14 13:06:13 -0300616
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300617$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100618 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
Ingo Molnard24e4732009-04-20 13:32:07 +0200619
Namhyung Kimaca7a942012-04-04 00:14:26 -0700620$(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100621 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -0300622
Namhyung Kimaca7a942012-04-04 00:14:26 -0700623$(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100624 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
Arnaldo Carvalho de Melo211ef122010-08-10 14:54:09 -0300625
Namhyung Kimaca7a942012-04-04 00:14:26 -0700626$(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100627 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
Arnaldo Carvalho de Melod1b4f242010-08-10 15:49:07 -0300628
Namhyung Kimaca7a942012-04-04 00:14:26 -0700629$(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100630 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
Arnaldo Carvalho de Melob1b02672010-08-10 15:37:34 -0300631
Feng Tang66517822012-10-30 11:56:04 +0800632$(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100633 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
Feng Tang66517822012-10-30 11:56:04 +0800634
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300635$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100636 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
Arnaldo Carvalho de Melo43cbcd82009-07-01 12:28:37 -0300637
Kirill A. Shutemov043d1a52012-07-24 00:04:07 +0300638$(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100639 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-redundant-decls $<
Kirill A. Shutemov043d1a52012-07-24 00:04:07 +0300640
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300641$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
Kirill A. Shutemov575bf1d2013-06-24 11:43:14 +0300642 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default $<
Tom Zanussi16c632d2009-11-25 01:15:48 -0600643
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300644$(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
Kirill A. Shutemov575bf1d2013-06-24 11:43:14 +0300645 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-undef -Wno-switch-default $<
Tom Zanussid1b93772009-11-25 01:15:50 -0600646
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300647$(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100648 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
Tom Zanussi7e4b21b2010-01-27 02:27:57 -0600649
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300650$(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100651 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
Tom Zanussi7e4b21b2010-01-27 02:27:57 -0600652
Michael Witten8796cb92011-02-02 11:57:41 -0600653$(OUTPUT)perf-%: %.o $(PERFLIBS)
Jiri Olsa1e9f7aa2013-03-21 11:41:05 +0100654 $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
Ingo Molnard24e4732009-04-20 13:32:07 +0200655
Ingo Molnard24e4732009-04-20 13:32:07 +0200656$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
Michael Witten8796cb92011-02-02 11:57:41 -0600657$(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
Ingo Molnard24e4732009-04-20 13:32:07 +0200658
Bernd Petrovitsch033a2732010-08-17 12:22:08 -0300659# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So
660# we depend the various files onto their directories.
661DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
Kusanagi Kouichi39cfae62010-09-26 14:17:42 -0300662$(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS)))
Bernd Petrovitsch033a2732010-08-17 12:22:08 -0300663# In the second step, we make a rule to actually create these directories
664$(sort $(dir $(DIRECTORY_DEPS))):
665 $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null
666
Ingo Molnard24e4732009-04-20 13:32:07 +0200667$(LIB_FILE): $(LIB_OBJS)
668 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
669
Namhyung Kim59f3bea2012-05-22 18:03:53 +0900670# libtraceevent.a
671$(LIBTRACEEVENT):
Robert Richter2ede8302012-08-07 19:43:12 +0200672 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libtraceevent.a
Steven Rostedtd0e7b852012-04-06 00:47:54 +0200673
David Aherneea9b682012-09-05 18:53:36 -0600674$(LIBTRACEEVENT)-clean:
675 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean
676
Borislav Petkov85c66be2013-02-20 16:32:30 +0100677# if subdir is set, we've been called from above so target has been built
678# already
679$(LIBLK):
680ifeq ($(subdir),)
681 $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a
682endif
683
684$(LIBLK)-clean:
685ifeq ($(subdir),)
686 $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean
687endif
688
Jesse Brandeburg4187e262011-02-09 17:11:00 -0800689help:
690 @echo 'Perf make targets:'
691 @echo ' doc - make *all* documentation (see below)'
692 @echo ' man - make manpage documentation (access with man <foo>)'
693 @echo ' html - make html documentation'
694 @echo ' info - make GNU info documentation (access with info <foo>)'
695 @echo ' pdf - make pdf documentation'
696 @echo ' TAGS - use etags to make tag information for source browsing'
697 @echo ' tags - use ctags to make tag information for source browsing'
698 @echo ' cscope - use cscope to make interactive browsing database'
699 @echo ''
700 @echo 'Perf install targets:'
701 @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
702 @echo ' HINT: use "make prefix=<path> <install target>" to install to a particular'
703 @echo ' path like make prefix=/usr/local install install-doc'
704 @echo ' install - install compiled binaries'
705 @echo ' install-doc - install *all* documentation'
706 @echo ' install-man - install manpage documentation'
707 @echo ' install-html - install html documentation'
708 @echo ' install-info - install GNU info documentation'
709 @echo ' install-pdf - install pdf documentation'
710 @echo ''
711 @echo ' quick-install-doc - alias for quick-install-man'
712 @echo ' quick-install-man - install the documentation quickly'
713 @echo ' quick-install-html - install the html documentation quickly'
714 @echo ''
715 @echo 'Perf maintainer targets:'
Jesse Brandeburg4187e262011-02-09 17:11:00 -0800716 @echo ' clean - clean all binary objects and build output'
717
Ingo Molnarc1c23652009-05-30 12:38:51 +0200718
Namhyung Kim536e2b02012-10-26 17:55:49 +0900719DOC_TARGETS := doc man html info pdf
Ingo Molnarc1c23652009-05-30 12:38:51 +0200720
Namhyung Kim536e2b02012-10-26 17:55:49 +0900721INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
722INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
Ingo Molnarc1c23652009-05-30 12:38:51 +0200723
Namhyung Kim536e2b02012-10-26 17:55:49 +0900724# 'make doc' should call 'make -C Documentation all'
725$(DOC_TARGETS):
Namhyung Kim615d7742012-10-26 17:55:50 +0900726 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
Ingo Molnarc1c23652009-05-30 12:38:51 +0200727
Ingo Molnard24e4732009-04-20 13:32:07 +0200728TAGS:
729 $(RM) TAGS
730 $(FIND) . -name '*.[hcS]' -print | xargs etags -a
731
732tags:
733 $(RM) tags
734 $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
735
736cscope:
737 $(RM) cscope*
738 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
739
740### Detect prefix changes
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100741TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\
Ingo Molnar07800602009-04-20 15:00:56 +0200742 $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
Ingo Molnard24e4732009-04-20 13:32:07 +0200743
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300744$(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
Ingo Molnard24e4732009-04-20 13:32:07 +0200745 @FLAGS='$(TRACK_CFLAGS)'; \
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300746 if test x"$$FLAGS" != x"`cat $(OUTPUT)PERF-CFLAGS 2>/dev/null`" ; then \
Ingo Molnard24e4732009-04-20 13:32:07 +0200747 echo 1>&2 " * new build flags or prefix"; \
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300748 echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \
Ingo Molnard24e4732009-04-20 13:32:07 +0200749 fi
750
Ingo Molnard24e4732009-04-20 13:32:07 +0200751### Testing rules
752
Ingo Molnard24e4732009-04-20 13:32:07 +0200753# GNU make supports exporting all variables by "export" without parameters.
754# However, the environment gets quite big, and some programs have problems
755# with that.
756
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300757check: $(OUTPUT)common-cmds.h
Ingo Molnard24e4732009-04-20 13:32:07 +0200758 if sparse; \
759 then \
Ingo Molnar148be2c2009-04-27 08:02:14 +0200760 for i in *.c */*.c; \
Ingo Molnard24e4732009-04-20 13:32:07 +0200761 do \
Jiri Olsa9c12cf92013-03-21 11:30:54 +0100762 sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
Ingo Molnard24e4732009-04-20 13:32:07 +0200763 done; \
764 else \
Ingo Molnard24e4732009-04-20 13:32:07 +0200765 exit 1; \
766 fi
767
Ingo Molnard24e4732009-04-20 13:32:07 +0200768### Installation rules
769
Arnaldo Carvalho de Melo40c5ec72012-12-11 09:54:21 -0300770install-bin: all
Ingo Molnard24e4732009-04-20 13:32:07 +0200771 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Michael Witten8796cb92011-02-02 11:57:41 -0600772 $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
Arnaldo Carvalho de Melo027a7e82013-10-04 10:24:17 -0300773 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
Arnaldo Carvalho de Melo8c9dc522013-08-20 16:15:06 -0300774 $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
775ifndef NO_LIBPERL
Tom Zanussibcefe122009-11-25 01:15:49 -0600776 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
777 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
778 $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
779 $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
780 $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
Arnaldo Carvalho de Melo8c9dc522013-08-20 16:15:06 -0300781endif
782ifndef NO_LIBPYTHON
Tom Zanussi7e4b21b2010-01-27 02:27:57 -0600783 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
Tom Zanussi4d161f02010-01-27 02:27:58 -0600784 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
Tom Zanussi7e4b21b2010-01-27 02:27:57 -0600785 $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
Tom Zanussi4d161f02010-01-27 02:27:58 -0600786 $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
787 $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
Arnaldo Carvalho de Melo8c9dc522013-08-20 16:15:06 -0300788endif
Namhyung Kimb25085b2012-08-09 16:31:53 +0200789 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
790 $(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
Jiri Olsad898b242012-10-30 23:02:05 +0100791 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
792 $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
793 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
794 $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
Tom Zanussi82d156c2010-01-27 02:27:55 -0600795
Arnaldo Carvalho de Melo40c5ec72012-12-11 09:54:21 -0300796install: install-bin try-install-man
797
Jiri Olsa9941c96a2011-07-22 13:33:07 +0200798install-python_ext:
799 $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
800
Namhyung Kim536e2b02012-10-26 17:55:49 +0900801# 'make install-doc' should call 'make -C Documentation install'
802$(INSTALL_DOC_TARGETS):
Namhyung Kim615d7742012-10-26 17:55:50 +0900803 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=)
Ingo Molnarc1c23652009-05-30 12:38:51 +0200804
Ingo Molnard24e4732009-04-20 13:32:07 +0200805### Cleaning rules
806
Borislav Petkov85c66be2013-02-20 16:32:30 +0100807clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean
Kusanagi Kouichi8b7e0b32011-08-07 17:39:31 +0900808 $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
Michael Wittena3d1ee12011-02-02 14:22:08 -0600809 $(RM) $(ALL_PROGRAMS) perf
Arnaldo Carvalho de Meloc29ede62010-03-27 14:30:45 -0300810 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
Namhyung Kim615d7742012-10-26 17:55:50 +0900811 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
Michael Wittena3d1ee12011-02-02 14:22:08 -0600812 $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS
Palmer Cox7f309ed2012-07-29 17:54:43 -0400813 $(RM) $(OUTPUT)util/*-bison*
814 $(RM) $(OUTPUT)util/*-flex*
Michael Wittenced465c2011-04-02 21:46:09 +0000815 $(python-clean)
Ingo Molnard24e4732009-04-20 13:32:07 +0200816
Borislav Petkov85c66be2013-02-20 16:32:30 +0100817.PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK)
Ingo Molnard24e4732009-04-20 13:32:07 +0200818.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Ingo Molnar07800602009-04-20 15:00:56 +0200819.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS