Commit 9c12cf95b32a099ac92ef0e9d138acb4bef984be

Authored by Jiri Olsa
Committed by Arnaldo Carvalho de Melo
1 parent 0817df08d3

perf tools: Merge all *CFLAGS* make variable into CFLAGS

Merging all *CFLAGS* make variable into CFLAGS to eliminate all special
*_CFLAGS_* variables and make the setup clear.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-19-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Showing 3 changed files with 89 additions and 84 deletions Inline Diff

1 include ../scripts/Makefile.include 1 include ../scripts/Makefile.include
2 2
3 # The default target of this Makefile is... 3 # The default target of this Makefile is...
4 all: 4 all:
5 5
6 include config/utilities.mak 6 include config/utilities.mak
7 7
8 # Define V to have a more verbose compile. 8 # Define V to have a more verbose compile.
9 # 9 #
10 # Define O to save output files in a separate directory. 10 # Define O to save output files in a separate directory.
11 # 11 #
12 # Define ARCH as name of target architecture if you want cross-builds. 12 # Define ARCH as name of target architecture if you want cross-builds.
13 # 13 #
14 # Define CROSS_COMPILE as prefix name of compiler if you want cross-builds. 14 # Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
15 # 15 #
16 # Define NO_LIBPERL to disable perl script extension. 16 # Define NO_LIBPERL to disable perl script extension.
17 # 17 #
18 # Define NO_LIBPYTHON to disable python script extension. 18 # Define NO_LIBPYTHON to disable python script extension.
19 # 19 #
20 # Define PYTHON to point to the python binary if the default 20 # Define PYTHON to point to the python binary if the default
21 # `python' is not correct; for example: PYTHON=python2 21 # `python' is not correct; for example: PYTHON=python2
22 # 22 #
23 # Define PYTHON_CONFIG to point to the python-config binary if 23 # Define PYTHON_CONFIG to point to the python-config binary if
24 # the default `$(PYTHON)-config' is not correct. 24 # the default `$(PYTHON)-config' is not correct.
25 # 25 #
26 # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8 26 # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
27 # 27 #
28 # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72. 28 # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
29 # 29 #
30 # Define LDFLAGS=-static to build a static binary. 30 # Define LDFLAGS=-static to build a static binary.
31 # 31 #
32 # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds. 32 # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
33 # 33 #
34 # Define NO_DWARF if you do not want debug-info analysis feature at all. 34 # Define NO_DWARF if you do not want debug-info analysis feature at all.
35 # 35 #
36 # Define WERROR=0 to disable treating any warnings as errors. 36 # Define WERROR=0 to disable treating any warnings as errors.
37 # 37 #
38 # Define NO_NEWT if you do not want TUI support. (deprecated) 38 # Define NO_NEWT if you do not want TUI support. (deprecated)
39 # 39 #
40 # Define NO_SLANG if you do not want TUI support. 40 # Define NO_SLANG if you do not want TUI support.
41 # 41 #
42 # Define NO_GTK2 if you do not want GTK+ GUI support. 42 # Define NO_GTK2 if you do not want GTK+ GUI support.
43 # 43 #
44 # Define NO_DEMANGLE if you do not want C++ symbol demangling. 44 # Define NO_DEMANGLE if you do not want C++ symbol demangling.
45 # 45 #
46 # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds) 46 # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
47 # 47 #
48 # Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf 48 # Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
49 # backtrace post unwind. 49 # backtrace post unwind.
50 # 50 #
51 # Define NO_BACKTRACE if you do not want stack backtrace debug feature 51 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
52 # 52 #
53 # Define NO_LIBNUMA if you do not want numa perf benchmark 53 # Define NO_LIBNUMA if you do not want numa perf benchmark
54 54
55 ifeq ($(srctree),) 55 ifeq ($(srctree),)
56 srctree := $(patsubst %/,%,$(dir $(shell pwd))) 56 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
57 srctree := $(patsubst %/,%,$(dir $(srctree))) 57 srctree := $(patsubst %/,%,$(dir $(srctree)))
58 #$(info Determined 'srctree' to be $(srctree)) 58 #$(info Determined 'srctree' to be $(srctree))
59 endif 59 endif
60 60
61 ifneq ($(objtree),) 61 ifneq ($(objtree),)
62 #$(info Determined 'objtree' to be $(objtree)) 62 #$(info Determined 'objtree' to be $(objtree))
63 endif 63 endif
64 64
65 ifneq ($(OUTPUT),) 65 ifneq ($(OUTPUT),)
66 #$(info Determined 'OUTPUT' to be $(OUTPUT)) 66 #$(info Determined 'OUTPUT' to be $(OUTPUT))
67 endif 67 endif
68 68
69 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE 69 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
70 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) 70 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
71 71
72 CC = $(CROSS_COMPILE)gcc 72 CC = $(CROSS_COMPILE)gcc
73 AR = $(CROSS_COMPILE)ar 73 AR = $(CROSS_COMPILE)ar
74 74
75 RM = rm -f 75 RM = rm -f
76 MKDIR = mkdir 76 MKDIR = mkdir
77 FIND = find 77 FIND = find
78 INSTALL = install 78 INSTALL = install
79 FLEX = flex 79 FLEX = flex
80 BISON = bison 80 BISON = bison
81 STRIP ?= strip 81 STRIP ?= strip
82 82
83 LK_DIR = ../lib/lk/ 83 LK_DIR = ../lib/lk/
84 TRACE_EVENT_DIR = ../lib/traceevent/ 84 TRACE_EVENT_DIR = ../lib/traceevent/
85 85
86 # include config/Makefile by default and rule out 86 # include config/Makefile by default and rule out
87 # non-config cases 87 # non-config cases
88 config := 1 88 config := 1
89 89
90 NON_CONFIG_TARGETS := clean TAGS tags cscope help 90 NON_CONFIG_TARGETS := clean TAGS tags cscope help
91 91
92 ifdef MAKECMDGOALS 92 ifdef MAKECMDGOALS
93 ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),) 93 ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
94 config := 0 94 config := 0
95 endif 95 endif
96 endif 96 endif
97 97
98 ifeq ($(config),1) 98 ifeq ($(config),1)
99 include config/Makefile 99 include config/Makefile
100 endif 100 endif
101 101
102 export prefix bindir sharedir sysconfdir 102 export prefix bindir sharedir sysconfdir
103 103
104 # sparse is architecture-neutral, which means that we need to tell it 104 # sparse is architecture-neutral, which means that we need to tell it
105 # explicitly what architecture to check for. Fix this up for yours.. 105 # explicitly what architecture to check for. Fix this up for yours..
106 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ 106 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
107 107
108 # Guard against environment variables 108 # Guard against environment variables
109 BUILTIN_OBJS = 109 BUILTIN_OBJS =
110 LIB_H = 110 LIB_H =
111 LIB_OBJS = 111 LIB_OBJS =
112 PYRF_OBJS = 112 PYRF_OBJS =
113 SCRIPT_SH = 113 SCRIPT_SH =
114 114
115 SCRIPT_SH += perf-archive.sh 115 SCRIPT_SH += perf-archive.sh
116 116
117 grep-libs = $(filter -l%,$(1)) 117 grep-libs = $(filter -l%,$(1))
118 strip-libs = $(filter-out -l%,$(1)) 118 strip-libs = $(filter-out -l%,$(1))
119 119
120 LK_PATH=$(LK_DIR) 120 LK_PATH=$(LK_DIR)
121 121
122 ifneq ($(OUTPUT),) 122 ifneq ($(OUTPUT),)
123 TE_PATH=$(OUTPUT) 123 TE_PATH=$(OUTPUT)
124 ifneq ($(subdir),) 124 ifneq ($(subdir),)
125 LK_PATH=$(OUTPUT)$(LK_DIR) 125 LK_PATH=$(OUTPUT)$(LK_DIR)
126 else 126 else
127 LK_PATH=$(OUTPUT) 127 LK_PATH=$(OUTPUT)
128 endif 128 endif
129 else 129 else
130 TE_PATH=$(TRACE_EVENT_DIR) 130 TE_PATH=$(TRACE_EVENT_DIR)
131 endif 131 endif
132 132
133 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a 133 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
134 export LIBTRACEEVENT 134 export LIBTRACEEVENT
135 135
136 LIBLK = $(LK_PATH)liblk.a 136 LIBLK = $(LK_PATH)liblk.a
137 export LIBLK 137 export LIBLK
138 138
139 # python extension build directories 139 # python extension build directories
140 PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/ 140 PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/
141 PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ 141 PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
142 PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/ 142 PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
143 export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP 143 export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
144 144
145 python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so 145 python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
146 146
147 PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) 147 PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
148 PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) 148 PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT)
149 149
150 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) 150 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
151 $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ 151 $(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
152 --quiet build_ext; \ 152 --quiet build_ext; \
153 mkdir -p $(OUTPUT)python && \ 153 mkdir -p $(OUTPUT)python && \
154 cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/ 154 cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
155 # 155 #
156 # No Perl scripts right now: 156 # No Perl scripts right now:
157 # 157 #
158 158
159 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) 159 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
160 160
161 # 161 #
162 # Single 'perf' binary right now: 162 # Single 'perf' binary right now:
163 # 163 #
164 PROGRAMS += $(OUTPUT)perf 164 PROGRAMS += $(OUTPUT)perf
165 165
166 # what 'all' will build and 'install' will install, in perfexecdir 166 # what 'all' will build and 'install' will install, in perfexecdir
167 ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) 167 ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
168 168
169 # what 'all' will build but not install in perfexecdir 169 # what 'all' will build but not install in perfexecdir
170 OTHER_PROGRAMS = $(OUTPUT)perf 170 OTHER_PROGRAMS = $(OUTPUT)perf
171 171
172 # Set paths to tools early so that they can be used for version tests. 172 # Set paths to tools early so that they can be used for version tests.
173 ifndef SHELL_PATH 173 ifndef SHELL_PATH
174 SHELL_PATH = /bin/sh 174 SHELL_PATH = /bin/sh
175 endif 175 endif
176 ifndef PERL_PATH 176 ifndef PERL_PATH
177 PERL_PATH = /usr/bin/perl 177 PERL_PATH = /usr/bin/perl
178 endif 178 endif
179 179
180 export PERL_PATH 180 export PERL_PATH
181 181
182 $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c 182 $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
183 $(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 183 $(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
184 184
185 $(OUTPUT)util/parse-events-bison.c: util/parse-events.y 185 $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
186 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_ 186 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
187 187
188 $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c 188 $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
189 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c 189 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
190 190
191 $(OUTPUT)util/pmu-bison.c: util/pmu.y 191 $(OUTPUT)util/pmu-bison.c: util/pmu.y
192 $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_ 192 $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
193 193
194 $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c 194 $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
195 $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c 195 $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
196 196
197 LIB_FILE=$(OUTPUT)libperf.a 197 LIB_FILE=$(OUTPUT)libperf.a
198 198
199 LIB_H += ../../include/uapi/linux/perf_event.h 199 LIB_H += ../../include/uapi/linux/perf_event.h
200 LIB_H += ../../include/linux/rbtree.h 200 LIB_H += ../../include/linux/rbtree.h
201 LIB_H += ../../include/linux/list.h 201 LIB_H += ../../include/linux/list.h
202 LIB_H += ../../include/uapi/linux/const.h 202 LIB_H += ../../include/uapi/linux/const.h
203 LIB_H += ../../include/linux/hash.h 203 LIB_H += ../../include/linux/hash.h
204 LIB_H += ../../include/linux/stringify.h 204 LIB_H += ../../include/linux/stringify.h
205 LIB_H += util/include/linux/bitmap.h 205 LIB_H += util/include/linux/bitmap.h
206 LIB_H += util/include/linux/bitops.h 206 LIB_H += util/include/linux/bitops.h
207 LIB_H += util/include/linux/compiler.h 207 LIB_H += util/include/linux/compiler.h
208 LIB_H += util/include/linux/const.h 208 LIB_H += util/include/linux/const.h
209 LIB_H += util/include/linux/ctype.h 209 LIB_H += util/include/linux/ctype.h
210 LIB_H += util/include/linux/kernel.h 210 LIB_H += util/include/linux/kernel.h
211 LIB_H += util/include/linux/list.h 211 LIB_H += util/include/linux/list.h
212 LIB_H += util/include/linux/export.h 212 LIB_H += util/include/linux/export.h
213 LIB_H += util/include/linux/magic.h 213 LIB_H += util/include/linux/magic.h
214 LIB_H += util/include/linux/poison.h 214 LIB_H += util/include/linux/poison.h
215 LIB_H += util/include/linux/prefetch.h 215 LIB_H += util/include/linux/prefetch.h
216 LIB_H += util/include/linux/rbtree.h 216 LIB_H += util/include/linux/rbtree.h
217 LIB_H += util/include/linux/rbtree_augmented.h 217 LIB_H += util/include/linux/rbtree_augmented.h
218 LIB_H += util/include/linux/string.h 218 LIB_H += util/include/linux/string.h
219 LIB_H += util/include/linux/types.h 219 LIB_H += util/include/linux/types.h
220 LIB_H += util/include/linux/linkage.h 220 LIB_H += util/include/linux/linkage.h
221 LIB_H += util/include/asm/asm-offsets.h 221 LIB_H += util/include/asm/asm-offsets.h
222 LIB_H += util/include/asm/bug.h 222 LIB_H += util/include/asm/bug.h
223 LIB_H += util/include/asm/byteorder.h 223 LIB_H += util/include/asm/byteorder.h
224 LIB_H += util/include/asm/hweight.h 224 LIB_H += util/include/asm/hweight.h
225 LIB_H += util/include/asm/swab.h 225 LIB_H += util/include/asm/swab.h
226 LIB_H += util/include/asm/system.h 226 LIB_H += util/include/asm/system.h
227 LIB_H += util/include/asm/uaccess.h 227 LIB_H += util/include/asm/uaccess.h
228 LIB_H += util/include/dwarf-regs.h 228 LIB_H += util/include/dwarf-regs.h
229 LIB_H += util/include/asm/dwarf2.h 229 LIB_H += util/include/asm/dwarf2.h
230 LIB_H += util/include/asm/cpufeature.h 230 LIB_H += util/include/asm/cpufeature.h
231 LIB_H += util/include/asm/unistd_32.h 231 LIB_H += util/include/asm/unistd_32.h
232 LIB_H += util/include/asm/unistd_64.h 232 LIB_H += util/include/asm/unistd_64.h
233 LIB_H += perf.h 233 LIB_H += perf.h
234 LIB_H += util/annotate.h 234 LIB_H += util/annotate.h
235 LIB_H += util/cache.h 235 LIB_H += util/cache.h
236 LIB_H += util/callchain.h 236 LIB_H += util/callchain.h
237 LIB_H += util/build-id.h 237 LIB_H += util/build-id.h
238 LIB_H += util/debug.h 238 LIB_H += util/debug.h
239 LIB_H += util/sysfs.h 239 LIB_H += util/sysfs.h
240 LIB_H += util/pmu.h 240 LIB_H += util/pmu.h
241 LIB_H += util/event.h 241 LIB_H += util/event.h
242 LIB_H += util/evsel.h 242 LIB_H += util/evsel.h
243 LIB_H += util/evlist.h 243 LIB_H += util/evlist.h
244 LIB_H += util/exec_cmd.h 244 LIB_H += util/exec_cmd.h
245 LIB_H += util/types.h 245 LIB_H += util/types.h
246 LIB_H += util/levenshtein.h 246 LIB_H += util/levenshtein.h
247 LIB_H += util/machine.h 247 LIB_H += util/machine.h
248 LIB_H += util/map.h 248 LIB_H += util/map.h
249 LIB_H += util/parse-options.h 249 LIB_H += util/parse-options.h
250 LIB_H += util/parse-events.h 250 LIB_H += util/parse-events.h
251 LIB_H += util/quote.h 251 LIB_H += util/quote.h
252 LIB_H += util/util.h 252 LIB_H += util/util.h
253 LIB_H += util/xyarray.h 253 LIB_H += util/xyarray.h
254 LIB_H += util/header.h 254 LIB_H += util/header.h
255 LIB_H += util/help.h 255 LIB_H += util/help.h
256 LIB_H += util/session.h 256 LIB_H += util/session.h
257 LIB_H += util/strbuf.h 257 LIB_H += util/strbuf.h
258 LIB_H += util/strlist.h 258 LIB_H += util/strlist.h
259 LIB_H += util/strfilter.h 259 LIB_H += util/strfilter.h
260 LIB_H += util/svghelper.h 260 LIB_H += util/svghelper.h
261 LIB_H += util/tool.h 261 LIB_H += util/tool.h
262 LIB_H += util/run-command.h 262 LIB_H += util/run-command.h
263 LIB_H += util/sigchain.h 263 LIB_H += util/sigchain.h
264 LIB_H += util/dso.h 264 LIB_H += util/dso.h
265 LIB_H += util/symbol.h 265 LIB_H += util/symbol.h
266 LIB_H += util/color.h 266 LIB_H += util/color.h
267 LIB_H += util/values.h 267 LIB_H += util/values.h
268 LIB_H += util/sort.h 268 LIB_H += util/sort.h
269 LIB_H += util/hist.h 269 LIB_H += util/hist.h
270 LIB_H += util/thread.h 270 LIB_H += util/thread.h
271 LIB_H += util/thread_map.h 271 LIB_H += util/thread_map.h
272 LIB_H += util/trace-event.h 272 LIB_H += util/trace-event.h
273 LIB_H += util/probe-finder.h 273 LIB_H += util/probe-finder.h
274 LIB_H += util/dwarf-aux.h 274 LIB_H += util/dwarf-aux.h
275 LIB_H += util/probe-event.h 275 LIB_H += util/probe-event.h
276 LIB_H += util/pstack.h 276 LIB_H += util/pstack.h
277 LIB_H += util/cpumap.h 277 LIB_H += util/cpumap.h
278 LIB_H += util/top.h 278 LIB_H += util/top.h
279 LIB_H += $(ARCH_INCLUDE) 279 LIB_H += $(ARCH_INCLUDE)
280 LIB_H += util/cgroup.h 280 LIB_H += util/cgroup.h
281 LIB_H += $(TRACE_EVENT_DIR)event-parse.h 281 LIB_H += $(TRACE_EVENT_DIR)event-parse.h
282 LIB_H += util/target.h 282 LIB_H += util/target.h
283 LIB_H += util/rblist.h 283 LIB_H += util/rblist.h
284 LIB_H += util/intlist.h 284 LIB_H += util/intlist.h
285 LIB_H += util/perf_regs.h 285 LIB_H += util/perf_regs.h
286 LIB_H += util/unwind.h 286 LIB_H += util/unwind.h
287 LIB_H += util/vdso.h 287 LIB_H += util/vdso.h
288 LIB_H += ui/helpline.h 288 LIB_H += ui/helpline.h
289 LIB_H += ui/progress.h 289 LIB_H += ui/progress.h
290 LIB_H += ui/util.h 290 LIB_H += ui/util.h
291 LIB_H += ui/ui.h 291 LIB_H += ui/ui.h
292 292
293 LIB_OBJS += $(OUTPUT)util/abspath.o 293 LIB_OBJS += $(OUTPUT)util/abspath.o
294 LIB_OBJS += $(OUTPUT)util/alias.o 294 LIB_OBJS += $(OUTPUT)util/alias.o
295 LIB_OBJS += $(OUTPUT)util/annotate.o 295 LIB_OBJS += $(OUTPUT)util/annotate.o
296 LIB_OBJS += $(OUTPUT)util/build-id.o 296 LIB_OBJS += $(OUTPUT)util/build-id.o
297 LIB_OBJS += $(OUTPUT)util/config.o 297 LIB_OBJS += $(OUTPUT)util/config.o
298 LIB_OBJS += $(OUTPUT)util/ctype.o 298 LIB_OBJS += $(OUTPUT)util/ctype.o
299 LIB_OBJS += $(OUTPUT)util/sysfs.o 299 LIB_OBJS += $(OUTPUT)util/sysfs.o
300 LIB_OBJS += $(OUTPUT)util/pmu.o 300 LIB_OBJS += $(OUTPUT)util/pmu.o
301 LIB_OBJS += $(OUTPUT)util/environment.o 301 LIB_OBJS += $(OUTPUT)util/environment.o
302 LIB_OBJS += $(OUTPUT)util/event.o 302 LIB_OBJS += $(OUTPUT)util/event.o
303 LIB_OBJS += $(OUTPUT)util/evlist.o 303 LIB_OBJS += $(OUTPUT)util/evlist.o
304 LIB_OBJS += $(OUTPUT)util/evsel.o 304 LIB_OBJS += $(OUTPUT)util/evsel.o
305 LIB_OBJS += $(OUTPUT)util/exec_cmd.o 305 LIB_OBJS += $(OUTPUT)util/exec_cmd.o
306 LIB_OBJS += $(OUTPUT)util/help.o 306 LIB_OBJS += $(OUTPUT)util/help.o
307 LIB_OBJS += $(OUTPUT)util/levenshtein.o 307 LIB_OBJS += $(OUTPUT)util/levenshtein.o
308 LIB_OBJS += $(OUTPUT)util/parse-options.o 308 LIB_OBJS += $(OUTPUT)util/parse-options.o
309 LIB_OBJS += $(OUTPUT)util/parse-events.o 309 LIB_OBJS += $(OUTPUT)util/parse-events.o
310 LIB_OBJS += $(OUTPUT)util/path.o 310 LIB_OBJS += $(OUTPUT)util/path.o
311 LIB_OBJS += $(OUTPUT)util/rbtree.o 311 LIB_OBJS += $(OUTPUT)util/rbtree.o
312 LIB_OBJS += $(OUTPUT)util/bitmap.o 312 LIB_OBJS += $(OUTPUT)util/bitmap.o
313 LIB_OBJS += $(OUTPUT)util/hweight.o 313 LIB_OBJS += $(OUTPUT)util/hweight.o
314 LIB_OBJS += $(OUTPUT)util/run-command.o 314 LIB_OBJS += $(OUTPUT)util/run-command.o
315 LIB_OBJS += $(OUTPUT)util/quote.o 315 LIB_OBJS += $(OUTPUT)util/quote.o
316 LIB_OBJS += $(OUTPUT)util/strbuf.o 316 LIB_OBJS += $(OUTPUT)util/strbuf.o
317 LIB_OBJS += $(OUTPUT)util/string.o 317 LIB_OBJS += $(OUTPUT)util/string.o
318 LIB_OBJS += $(OUTPUT)util/strlist.o 318 LIB_OBJS += $(OUTPUT)util/strlist.o
319 LIB_OBJS += $(OUTPUT)util/strfilter.o 319 LIB_OBJS += $(OUTPUT)util/strfilter.o
320 LIB_OBJS += $(OUTPUT)util/top.o 320 LIB_OBJS += $(OUTPUT)util/top.o
321 LIB_OBJS += $(OUTPUT)util/usage.o 321 LIB_OBJS += $(OUTPUT)util/usage.o
322 LIB_OBJS += $(OUTPUT)util/wrapper.o 322 LIB_OBJS += $(OUTPUT)util/wrapper.o
323 LIB_OBJS += $(OUTPUT)util/sigchain.o 323 LIB_OBJS += $(OUTPUT)util/sigchain.o
324 LIB_OBJS += $(OUTPUT)util/dso.o 324 LIB_OBJS += $(OUTPUT)util/dso.o
325 LIB_OBJS += $(OUTPUT)util/symbol.o 325 LIB_OBJS += $(OUTPUT)util/symbol.o
326 LIB_OBJS += $(OUTPUT)util/symbol-elf.o 326 LIB_OBJS += $(OUTPUT)util/symbol-elf.o
327 LIB_OBJS += $(OUTPUT)util/color.o 327 LIB_OBJS += $(OUTPUT)util/color.o
328 LIB_OBJS += $(OUTPUT)util/pager.o 328 LIB_OBJS += $(OUTPUT)util/pager.o
329 LIB_OBJS += $(OUTPUT)util/header.o 329 LIB_OBJS += $(OUTPUT)util/header.o
330 LIB_OBJS += $(OUTPUT)util/callchain.o 330 LIB_OBJS += $(OUTPUT)util/callchain.o
331 LIB_OBJS += $(OUTPUT)util/values.o 331 LIB_OBJS += $(OUTPUT)util/values.o
332 LIB_OBJS += $(OUTPUT)util/debug.o 332 LIB_OBJS += $(OUTPUT)util/debug.o
333 LIB_OBJS += $(OUTPUT)util/machine.o 333 LIB_OBJS += $(OUTPUT)util/machine.o
334 LIB_OBJS += $(OUTPUT)util/map.o 334 LIB_OBJS += $(OUTPUT)util/map.o
335 LIB_OBJS += $(OUTPUT)util/pstack.o 335 LIB_OBJS += $(OUTPUT)util/pstack.o
336 LIB_OBJS += $(OUTPUT)util/session.o 336 LIB_OBJS += $(OUTPUT)util/session.o
337 LIB_OBJS += $(OUTPUT)util/thread.o 337 LIB_OBJS += $(OUTPUT)util/thread.o
338 LIB_OBJS += $(OUTPUT)util/thread_map.o 338 LIB_OBJS += $(OUTPUT)util/thread_map.o
339 LIB_OBJS += $(OUTPUT)util/trace-event-parse.o 339 LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
340 LIB_OBJS += $(OUTPUT)util/parse-events-flex.o 340 LIB_OBJS += $(OUTPUT)util/parse-events-flex.o
341 LIB_OBJS += $(OUTPUT)util/parse-events-bison.o 341 LIB_OBJS += $(OUTPUT)util/parse-events-bison.o
342 LIB_OBJS += $(OUTPUT)util/pmu-flex.o 342 LIB_OBJS += $(OUTPUT)util/pmu-flex.o
343 LIB_OBJS += $(OUTPUT)util/pmu-bison.o 343 LIB_OBJS += $(OUTPUT)util/pmu-bison.o
344 LIB_OBJS += $(OUTPUT)util/trace-event-read.o 344 LIB_OBJS += $(OUTPUT)util/trace-event-read.o
345 LIB_OBJS += $(OUTPUT)util/trace-event-info.o 345 LIB_OBJS += $(OUTPUT)util/trace-event-info.o
346 LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o 346 LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
347 LIB_OBJS += $(OUTPUT)util/svghelper.o 347 LIB_OBJS += $(OUTPUT)util/svghelper.o
348 LIB_OBJS += $(OUTPUT)util/sort.o 348 LIB_OBJS += $(OUTPUT)util/sort.o
349 LIB_OBJS += $(OUTPUT)util/hist.o 349 LIB_OBJS += $(OUTPUT)util/hist.o
350 LIB_OBJS += $(OUTPUT)util/probe-event.o 350 LIB_OBJS += $(OUTPUT)util/probe-event.o
351 LIB_OBJS += $(OUTPUT)util/util.o 351 LIB_OBJS += $(OUTPUT)util/util.o
352 LIB_OBJS += $(OUTPUT)util/xyarray.o 352 LIB_OBJS += $(OUTPUT)util/xyarray.o
353 LIB_OBJS += $(OUTPUT)util/cpumap.o 353 LIB_OBJS += $(OUTPUT)util/cpumap.o
354 LIB_OBJS += $(OUTPUT)util/cgroup.o 354 LIB_OBJS += $(OUTPUT)util/cgroup.o
355 LIB_OBJS += $(OUTPUT)util/target.o 355 LIB_OBJS += $(OUTPUT)util/target.o
356 LIB_OBJS += $(OUTPUT)util/rblist.o 356 LIB_OBJS += $(OUTPUT)util/rblist.o
357 LIB_OBJS += $(OUTPUT)util/intlist.o 357 LIB_OBJS += $(OUTPUT)util/intlist.o
358 LIB_OBJS += $(OUTPUT)util/vdso.o 358 LIB_OBJS += $(OUTPUT)util/vdso.o
359 LIB_OBJS += $(OUTPUT)util/stat.o 359 LIB_OBJS += $(OUTPUT)util/stat.o
360 360
361 LIB_OBJS += $(OUTPUT)ui/setup.o 361 LIB_OBJS += $(OUTPUT)ui/setup.o
362 LIB_OBJS += $(OUTPUT)ui/helpline.o 362 LIB_OBJS += $(OUTPUT)ui/helpline.o
363 LIB_OBJS += $(OUTPUT)ui/progress.o 363 LIB_OBJS += $(OUTPUT)ui/progress.o
364 LIB_OBJS += $(OUTPUT)ui/util.o 364 LIB_OBJS += $(OUTPUT)ui/util.o
365 LIB_OBJS += $(OUTPUT)ui/hist.o 365 LIB_OBJS += $(OUTPUT)ui/hist.o
366 LIB_OBJS += $(OUTPUT)ui/stdio/hist.o 366 LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
367 367
368 LIB_OBJS += $(OUTPUT)arch/common.o 368 LIB_OBJS += $(OUTPUT)arch/common.o
369 369
370 LIB_OBJS += $(OUTPUT)tests/parse-events.o 370 LIB_OBJS += $(OUTPUT)tests/parse-events.o
371 LIB_OBJS += $(OUTPUT)tests/dso-data.o 371 LIB_OBJS += $(OUTPUT)tests/dso-data.o
372 LIB_OBJS += $(OUTPUT)tests/attr.o 372 LIB_OBJS += $(OUTPUT)tests/attr.o
373 LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o 373 LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
374 LIB_OBJS += $(OUTPUT)tests/open-syscall.o 374 LIB_OBJS += $(OUTPUT)tests/open-syscall.o
375 LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o 375 LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
376 LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o 376 LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o
377 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o 377 LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
378 LIB_OBJS += $(OUTPUT)tests/perf-record.o 378 LIB_OBJS += $(OUTPUT)tests/perf-record.o
379 LIB_OBJS += $(OUTPUT)tests/rdpmc.o 379 LIB_OBJS += $(OUTPUT)tests/rdpmc.o
380 LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o 380 LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
381 LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o 381 LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
382 LIB_OBJS += $(OUTPUT)tests/pmu.o 382 LIB_OBJS += $(OUTPUT)tests/pmu.o
383 LIB_OBJS += $(OUTPUT)tests/hists_link.o 383 LIB_OBJS += $(OUTPUT)tests/hists_link.o
384 LIB_OBJS += $(OUTPUT)tests/python-use.o 384 LIB_OBJS += $(OUTPUT)tests/python-use.o
385 LIB_OBJS += $(OUTPUT)tests/bp_signal.o 385 LIB_OBJS += $(OUTPUT)tests/bp_signal.o
386 LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o 386 LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o
387 LIB_OBJS += $(OUTPUT)tests/task-exit.o 387 LIB_OBJS += $(OUTPUT)tests/task-exit.o
388 LIB_OBJS += $(OUTPUT)tests/sw-clock.o 388 LIB_OBJS += $(OUTPUT)tests/sw-clock.o
389 389
390 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o 390 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
391 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o 391 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
392 # Benchmark modules 392 # Benchmark modules
393 BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o 393 BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
394 BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o 394 BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
395 ifeq ($(RAW_ARCH),x86_64) 395 ifeq ($(RAW_ARCH),x86_64)
396 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o 396 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
397 BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o 397 BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
398 endif 398 endif
399 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o 399 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
400 BUILTIN_OBJS += $(OUTPUT)bench/mem-memset.o 400 BUILTIN_OBJS += $(OUTPUT)bench/mem-memset.o
401 401
402 BUILTIN_OBJS += $(OUTPUT)builtin-diff.o 402 BUILTIN_OBJS += $(OUTPUT)builtin-diff.o
403 BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o 403 BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o
404 BUILTIN_OBJS += $(OUTPUT)builtin-help.o 404 BUILTIN_OBJS += $(OUTPUT)builtin-help.o
405 BUILTIN_OBJS += $(OUTPUT)builtin-sched.o 405 BUILTIN_OBJS += $(OUTPUT)builtin-sched.o
406 BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o 406 BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o
407 BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o 407 BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o
408 BUILTIN_OBJS += $(OUTPUT)builtin-list.o 408 BUILTIN_OBJS += $(OUTPUT)builtin-list.o
409 BUILTIN_OBJS += $(OUTPUT)builtin-record.o 409 BUILTIN_OBJS += $(OUTPUT)builtin-record.o
410 BUILTIN_OBJS += $(OUTPUT)builtin-report.o 410 BUILTIN_OBJS += $(OUTPUT)builtin-report.o
411 BUILTIN_OBJS += $(OUTPUT)builtin-stat.o 411 BUILTIN_OBJS += $(OUTPUT)builtin-stat.o
412 BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o 412 BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o
413 BUILTIN_OBJS += $(OUTPUT)builtin-top.o 413 BUILTIN_OBJS += $(OUTPUT)builtin-top.o
414 BUILTIN_OBJS += $(OUTPUT)builtin-script.o 414 BUILTIN_OBJS += $(OUTPUT)builtin-script.o
415 BUILTIN_OBJS += $(OUTPUT)builtin-probe.o 415 BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
416 BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o 416 BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
417 BUILTIN_OBJS += $(OUTPUT)builtin-lock.o 417 BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
418 BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o 418 BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
419 BUILTIN_OBJS += $(OUTPUT)builtin-inject.o 419 BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
420 BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o 420 BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
421 BUILTIN_OBJS += $(OUTPUT)builtin-mem.o 421 BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
422 422
423 PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT) 423 PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT)
424 424
425 # We choose to avoid "if .. else if .. else .. endif endif" 425 # We choose to avoid "if .. else if .. else .. endif endif"
426 # because maintaining the nesting to match is a pain. If 426 # because maintaining the nesting to match is a pain. If
427 # we had "elif" things would have been much nicer... 427 # we had "elif" things would have been much nicer...
428 428
429 -include arch/$(ARCH)/Makefile 429 -include arch/$(ARCH)/Makefile
430 430
431 ifneq ($(OUTPUT),) 431 ifneq ($(OUTPUT),)
432 BASIC_CFLAGS += -I$(OUTPUT) 432 CFLAGS += -I$(OUTPUT)
433 endif 433 endif
434 434
435 ifdef NO_LIBELF 435 ifdef NO_LIBELF
436 EXTLIBS := $(filter-out -lelf,$(EXTLIBS)) 436 EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
437 437
438 # Remove ELF/DWARF dependent codes 438 # Remove ELF/DWARF dependent codes
439 LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS)) 439 LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
440 LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS)) 440 LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
441 LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS)) 441 LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
442 LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS)) 442 LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS))
443 443
444 BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS)) 444 BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
445 445
446 # Use minimal symbol handling 446 # Use minimal symbol handling
447 LIB_OBJS += $(OUTPUT)util/symbol-minimal.o 447 LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
448 448
449 else # NO_LIBELF 449 else # NO_LIBELF
450 ifndef NO_DWARF 450 ifndef NO_DWARF
451 LIB_OBJS += $(OUTPUT)util/probe-finder.o 451 LIB_OBJS += $(OUTPUT)util/probe-finder.o
452 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o 452 LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
453 endif # NO_DWARF 453 endif # NO_DWARF
454 endif # NO_LIBELF 454 endif # NO_LIBELF
455 455
456 ifndef NO_LIBUNWIND 456 ifndef NO_LIBUNWIND
457 LIB_OBJS += $(OUTPUT)util/unwind.o 457 LIB_OBJS += $(OUTPUT)util/unwind.o
458 endif 458 endif
459 459
460 ifndef NO_LIBAUDIT 460 ifndef NO_LIBAUDIT
461 BUILTIN_OBJS += $(OUTPUT)builtin-trace.o 461 BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
462 endif 462 endif
463 463
464 ifndef NO_SLANG 464 ifndef NO_SLANG
465 LIB_OBJS += $(OUTPUT)ui/browser.o 465 LIB_OBJS += $(OUTPUT)ui/browser.o
466 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o 466 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
467 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o 467 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
468 LIB_OBJS += $(OUTPUT)ui/browsers/map.o 468 LIB_OBJS += $(OUTPUT)ui/browsers/map.o
469 LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o 469 LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
470 LIB_OBJS += $(OUTPUT)ui/tui/setup.o 470 LIB_OBJS += $(OUTPUT)ui/tui/setup.o
471 LIB_OBJS += $(OUTPUT)ui/tui/util.o 471 LIB_OBJS += $(OUTPUT)ui/tui/util.o
472 LIB_OBJS += $(OUTPUT)ui/tui/helpline.o 472 LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
473 LIB_OBJS += $(OUTPUT)ui/tui/progress.o 473 LIB_OBJS += $(OUTPUT)ui/tui/progress.o
474 LIB_H += ui/browser.h 474 LIB_H += ui/browser.h
475 LIB_H += ui/browsers/map.h 475 LIB_H += ui/browsers/map.h
476 LIB_H += ui/keysyms.h 476 LIB_H += ui/keysyms.h
477 LIB_H += ui/libslang.h 477 LIB_H += ui/libslang.h
478 endif 478 endif
479 479
480 ifndef NO_GTK2 480 ifndef NO_GTK2
481 LIB_OBJS += $(OUTPUT)ui/gtk/browser.o 481 LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
482 LIB_OBJS += $(OUTPUT)ui/gtk/hists.o 482 LIB_OBJS += $(OUTPUT)ui/gtk/hists.o
483 LIB_OBJS += $(OUTPUT)ui/gtk/setup.o 483 LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
484 LIB_OBJS += $(OUTPUT)ui/gtk/util.o 484 LIB_OBJS += $(OUTPUT)ui/gtk/util.o
485 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o 485 LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
486 LIB_OBJS += $(OUTPUT)ui/gtk/progress.o 486 LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
487 LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o 487 LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o
488 endif 488 endif
489 489
490 ifndef NO_LIBPERL 490 ifndef NO_LIBPERL
491 LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o 491 LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
492 LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o 492 LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
493 endif 493 endif
494 494
495 ifndef NO_LIBPYTHON 495 ifndef NO_LIBPYTHON
496 LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o 496 LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
497 LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o 497 LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
498 endif 498 endif
499 499
500 ifeq ($(NO_PERF_REGS),0) 500 ifeq ($(NO_PERF_REGS),0)
501 ifeq ($(ARCH),x86) 501 ifeq ($(ARCH),x86)
502 LIB_H += arch/x86/include/perf_regs.h 502 LIB_H += arch/x86/include/perf_regs.h
503 endif 503 endif
504 endif 504 endif
505 505
506 ifndef NO_LIBNUMA 506 ifndef NO_LIBNUMA
507 BUILTIN_OBJS += $(OUTPUT)bench/numa.o 507 BUILTIN_OBJS += $(OUTPUT)bench/numa.o
508 endif 508 endif
509 509
510 ifdef ASCIIDOC8 510 ifdef ASCIIDOC8
511 export ASCIIDOC8 511 export ASCIIDOC8
512 endif 512 endif
513 513
514 LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group 514 LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
515 515
516 ALL_CFLAGS += $(BASIC_CFLAGS)
517 ALL_CFLAGS += $(ARCH_CFLAGS)
518 ALL_LDFLAGS += $(BASIC_LDFLAGS) 516 ALL_LDFLAGS += $(BASIC_LDFLAGS)
519 517
520 export INSTALL SHELL_PATH 518 export INSTALL SHELL_PATH
521 519
522 ### Build rules 520 ### Build rules
523 521
524 SHELL = $(SHELL_PATH) 522 SHELL = $(SHELL_PATH)
525 523
526 all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) 524 all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
527 525
528 please_set_SHELL_PATH_to_a_more_modern_shell: 526 please_set_SHELL_PATH_to_a_more_modern_shell:
529 @$$(:) 527 @$$(:)
530 528
531 shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell 529 shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
532 530
533 strip: $(PROGRAMS) $(OUTPUT)perf 531 strip: $(PROGRAMS) $(OUTPUT)perf
534 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf 532 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
535 533
536 $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS 534 $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
537 $(QUIET_CC)$(CC) -include $(OUTPUT)PERF-VERSION-FILE \ 535 $(QUIET_CC)$(CC) -include $(OUTPUT)PERF-VERSION-FILE \
538 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ 536 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
539 $(ALL_CFLAGS) -c $(filter %.c,$^) -o $@ 537 $(CFLAGS) -c $(filter %.c,$^) -o $@
540 538
541 $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) 539 $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
542 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \ 540 $(QUIET_LINK)$(CC) $(CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \
543 $(BUILTIN_OBJS) $(LIBS) -o $@ 541 $(BUILTIN_OBJS) $(LIBS) -o $@
544 542
545 $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS 543 $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
546 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ 544 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
547 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ 545 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
548 '-DPERF_MAN_PATH="$(mandir_SQ)"' \ 546 '-DPERF_MAN_PATH="$(mandir_SQ)"' \
549 '-DPERF_INFO_PATH="$(infodir_SQ)"' $< 547 '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
550 548
551 $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS 549 $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
552 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ 550 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
553 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ 551 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
554 '-DPERF_MAN_PATH="$(mandir_SQ)"' \ 552 '-DPERF_MAN_PATH="$(mandir_SQ)"' \
555 '-DPERF_INFO_PATH="$(infodir_SQ)"' $< 553 '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
556 554
557 $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt 555 $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
558 556
559 $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt) 557 $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
560 $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ 558 $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
561 559
562 $(SCRIPTS) : % : %.sh 560 $(SCRIPTS) : % : %.sh
563 $(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@' 561 $(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
564 562
565 # These can record PERF_VERSION 563 # These can record PERF_VERSION
566 $(OUTPUT)perf.o perf.spec \ 564 $(OUTPUT)perf.o perf.spec \
567 $(SCRIPTS) \ 565 $(SCRIPTS) \
568 : $(OUTPUT)PERF-VERSION-FILE 566 : $(OUTPUT)PERF-VERSION-FILE
569 567
570 .SUFFIXES: 568 .SUFFIXES:
571 .SUFFIXES: .o .c .S .s 569 .SUFFIXES: .o .c .S .s
572 570
573 # These two need to be here so that when O= is not used they take precedence 571 # These two need to be here so that when O= is not used they take precedence
574 # over the general rule for .o 572 # over the general rule for .o
575 573
576 $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS 574 $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
577 $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(ALL_CFLAGS) -w $< 575 $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -w $<
578 576
579 $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS 577 $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
580 $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $< 578 $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
581 579
582 $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS 580 $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
583 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< 581 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
584 $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS 582 $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
585 $(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $< 583 $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
586 $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS 584 $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
587 $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $< 585 $(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $<
588 $(OUTPUT)%.o: %.S 586 $(OUTPUT)%.o: %.S
589 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< 587 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
590 $(OUTPUT)%.s: %.S 588 $(OUTPUT)%.s: %.S
591 $(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $< 589 $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
592 590
593 $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS 591 $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
594 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ 592 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
595 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \ 593 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
596 '-DPREFIX="$(prefix_SQ)"' \ 594 '-DPREFIX="$(prefix_SQ)"' \
597 $< 595 $<
598 596
599 $(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS 597 $(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS
600 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ 598 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
601 '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \ 599 '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \
602 $< 600 $<
603 601
604 $(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS 602 $(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS
605 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ 603 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
606 -DPYTHONPATH='"$(OUTPUT)python"' \ 604 -DPYTHONPATH='"$(OUTPUT)python"' \
607 -DPYTHON='"$(PYTHON_WORD)"' \ 605 -DPYTHON='"$(PYTHON_WORD)"' \
608 $< 606 $<
609 607
610 $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS 608 $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
611 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< 609 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
612 610
613 $(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS 611 $(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS
614 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< 612 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
615 613
616 $(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS 614 $(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
617 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< 615 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
618 616
619 $(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS 617 $(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS
620 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< 618 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
621 619
622 $(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS 620 $(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
623 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< 621 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
624 622
625 $(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS 623 $(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
626 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< 624 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
627 625
628 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS 626 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
629 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< 627 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
630 628
631 $(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS 629 $(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS
632 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls $< 630 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-redundant-decls $<
633 631
634 $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS 632 $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
635 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< 633 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
636 634
637 $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS 635 $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
638 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< 636 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
639 637
640 $(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS 638 $(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS
641 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< 639 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
642 640
643 $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS 641 $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
644 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< 642 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
645 643
646 $(OUTPUT)perf-%: %.o $(PERFLIBS) 644 $(OUTPUT)perf-%: %.o $(PERFLIBS)
647 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) 645 $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
648 646
649 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) 647 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
650 $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) 648 $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
651 649
652 # we compile into subdirectories. if the target directory is not the source directory, they might not exists. So 650 # we compile into subdirectories. if the target directory is not the source directory, they might not exists. So
653 # we depend the various files onto their directories. 651 # we depend the various files onto their directories.
654 DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h 652 DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
655 $(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS))) 653 $(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS)))
656 # In the second step, we make a rule to actually create these directories 654 # In the second step, we make a rule to actually create these directories
657 $(sort $(dir $(DIRECTORY_DEPS))): 655 $(sort $(dir $(DIRECTORY_DEPS))):
658 $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null 656 $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null
659 657
660 $(LIB_FILE): $(LIB_OBJS) 658 $(LIB_FILE): $(LIB_OBJS)
661 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) 659 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
662 660
663 # libtraceevent.a 661 # libtraceevent.a
664 $(LIBTRACEEVENT): 662 $(LIBTRACEEVENT):
665 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libtraceevent.a 663 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libtraceevent.a
666 664
667 $(LIBTRACEEVENT)-clean: 665 $(LIBTRACEEVENT)-clean:
668 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean 666 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean
669 667
670 # if subdir is set, we've been called from above so target has been built 668 # if subdir is set, we've been called from above so target has been built
671 # already 669 # already
672 $(LIBLK): 670 $(LIBLK):
673 ifeq ($(subdir),) 671 ifeq ($(subdir),)
674 $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a 672 $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a
675 endif 673 endif
676 674
677 $(LIBLK)-clean: 675 $(LIBLK)-clean:
678 ifeq ($(subdir),) 676 ifeq ($(subdir),)
679 $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean 677 $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean
680 endif 678 endif
681 679
682 help: 680 help:
683 @echo 'Perf make targets:' 681 @echo 'Perf make targets:'
684 @echo ' doc - make *all* documentation (see below)' 682 @echo ' doc - make *all* documentation (see below)'
685 @echo ' man - make manpage documentation (access with man <foo>)' 683 @echo ' man - make manpage documentation (access with man <foo>)'
686 @echo ' html - make html documentation' 684 @echo ' html - make html documentation'
687 @echo ' info - make GNU info documentation (access with info <foo>)' 685 @echo ' info - make GNU info documentation (access with info <foo>)'
688 @echo ' pdf - make pdf documentation' 686 @echo ' pdf - make pdf documentation'
689 @echo ' TAGS - use etags to make tag information for source browsing' 687 @echo ' TAGS - use etags to make tag information for source browsing'
690 @echo ' tags - use ctags to make tag information for source browsing' 688 @echo ' tags - use ctags to make tag information for source browsing'
691 @echo ' cscope - use cscope to make interactive browsing database' 689 @echo ' cscope - use cscope to make interactive browsing database'
692 @echo '' 690 @echo ''
693 @echo 'Perf install targets:' 691 @echo 'Perf install targets:'
694 @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed' 692 @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
695 @echo ' HINT: use "make prefix=<path> <install target>" to install to a particular' 693 @echo ' HINT: use "make prefix=<path> <install target>" to install to a particular'
696 @echo ' path like make prefix=/usr/local install install-doc' 694 @echo ' path like make prefix=/usr/local install install-doc'
697 @echo ' install - install compiled binaries' 695 @echo ' install - install compiled binaries'
698 @echo ' install-doc - install *all* documentation' 696 @echo ' install-doc - install *all* documentation'
699 @echo ' install-man - install manpage documentation' 697 @echo ' install-man - install manpage documentation'
700 @echo ' install-html - install html documentation' 698 @echo ' install-html - install html documentation'
701 @echo ' install-info - install GNU info documentation' 699 @echo ' install-info - install GNU info documentation'
702 @echo ' install-pdf - install pdf documentation' 700 @echo ' install-pdf - install pdf documentation'
703 @echo '' 701 @echo ''
704 @echo ' quick-install-doc - alias for quick-install-man' 702 @echo ' quick-install-doc - alias for quick-install-man'
705 @echo ' quick-install-man - install the documentation quickly' 703 @echo ' quick-install-man - install the documentation quickly'
706 @echo ' quick-install-html - install the html documentation quickly' 704 @echo ' quick-install-html - install the html documentation quickly'
707 @echo '' 705 @echo ''
708 @echo 'Perf maintainer targets:' 706 @echo 'Perf maintainer targets:'
709 @echo ' clean - clean all binary objects and build output' 707 @echo ' clean - clean all binary objects and build output'
710 708
711 709
712 DOC_TARGETS := doc man html info pdf 710 DOC_TARGETS := doc man html info pdf
713 711
714 INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man 712 INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
715 INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html 713 INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
716 714
717 # 'make doc' should call 'make -C Documentation all' 715 # 'make doc' should call 'make -C Documentation all'
718 $(DOC_TARGETS): 716 $(DOC_TARGETS):
719 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all) 717 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
720 718
721 TAGS: 719 TAGS:
722 $(RM) TAGS 720 $(RM) TAGS
723 $(FIND) . -name '*.[hcS]' -print | xargs etags -a 721 $(FIND) . -name '*.[hcS]' -print | xargs etags -a
724 722
725 tags: 723 tags:
726 $(RM) tags 724 $(RM) tags
727 $(FIND) . -name '*.[hcS]' -print | xargs ctags -a 725 $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
728 726
729 cscope: 727 cscope:
730 $(RM) cscope* 728 $(RM) cscope*
731 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b 729 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
732 730
733 ### Detect prefix changes 731 ### Detect prefix changes
734 TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ 732 TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\
735 $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) 733 $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
736 734
737 $(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS 735 $(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
738 @FLAGS='$(TRACK_CFLAGS)'; \ 736 @FLAGS='$(TRACK_CFLAGS)'; \
739 if test x"$$FLAGS" != x"`cat $(OUTPUT)PERF-CFLAGS 2>/dev/null`" ; then \ 737 if test x"$$FLAGS" != x"`cat $(OUTPUT)PERF-CFLAGS 2>/dev/null`" ; then \
740 echo 1>&2 " * new build flags or prefix"; \ 738 echo 1>&2 " * new build flags or prefix"; \
741 echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \ 739 echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \
742 fi 740 fi
743 741
744 ### Testing rules 742 ### Testing rules
745 743
746 # GNU make supports exporting all variables by "export" without parameters. 744 # GNU make supports exporting all variables by "export" without parameters.
747 # However, the environment gets quite big, and some programs have problems 745 # However, the environment gets quite big, and some programs have problems
748 # with that. 746 # with that.
749 747
750 check: $(OUTPUT)common-cmds.h 748 check: $(OUTPUT)common-cmds.h
751 if sparse; \ 749 if sparse; \
752 then \ 750 then \
753 for i in *.c */*.c; \ 751 for i in *.c */*.c; \
754 do \ 752 do \
755 sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ 753 sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
756 done; \ 754 done; \
757 else \ 755 else \
758 exit 1; \ 756 exit 1; \
759 fi 757 fi
760 758
761 ### Installation rules 759 ### Installation rules
762 760
763 install-bin: all 761 install-bin: all
764 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' 762 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
765 $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)' 763 $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
766 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' 764 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
767 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' 765 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
768 $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 766 $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
769 $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' 767 $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
770 $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl' 768 $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
771 $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' 769 $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
772 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' 770 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
773 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' 771 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
774 $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' 772 $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
775 $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' 773 $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
776 $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' 774 $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
777 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d' 775 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
778 $(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf' 776 $(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
779 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' 777 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
780 $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' 778 $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
781 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr' 779 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
782 $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr' 780 $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
783 781
784 install: install-bin try-install-man 782 install: install-bin try-install-man
785 783
786 install-python_ext: 784 install-python_ext:
787 $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)' 785 $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
788 786
789 # 'make install-doc' should call 'make -C Documentation install' 787 # 'make install-doc' should call 'make -C Documentation install'
790 $(INSTALL_DOC_TARGETS): 788 $(INSTALL_DOC_TARGETS):
791 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=) 789 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=)
792 790
793 ### Cleaning rules 791 ### Cleaning rules
794 792
795 clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean 793 clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean
796 $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) 794 $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
797 $(RM) $(ALL_PROGRAMS) perf 795 $(RM) $(ALL_PROGRAMS) perf
798 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* 796 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
799 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean 797 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
800 $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS 798 $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS
801 $(RM) $(OUTPUT)util/*-bison* 799 $(RM) $(OUTPUT)util/*-bison*
802 $(RM) $(OUTPUT)util/*-flex* 800 $(RM) $(OUTPUT)util/*-flex*
803 $(python-clean) 801 $(python-clean)
804 802
805 .PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK) 803 .PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK)
806 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell 804 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
807 .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS 805 .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
808 806
tools/perf/config/Makefile
1 uname_M := $(shell uname -m 2>/dev/null || echo not) 1 uname_M := $(shell uname -m 2>/dev/null || echo not)
2 2
3 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ 3 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
4 -e s/arm.*/arm/ -e s/sa110/arm/ \ 4 -e s/arm.*/arm/ -e s/sa110/arm/ \
5 -e s/s390x/s390/ -e s/parisc64/parisc/ \ 5 -e s/s390x/s390/ -e s/parisc64/parisc/ \
6 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ 6 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
7 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) 7 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )
8 NO_PERF_REGS := 1 8 NO_PERF_REGS := 1
9 CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
9 10
10 # Additional ARCH settings for x86 11 # Additional ARCH settings for x86
11 ifeq ($(ARCH),i386) 12 ifeq ($(ARCH),i386)
12 override ARCH := x86 13 override ARCH := x86
13 NO_PERF_REGS := 0 14 NO_PERF_REGS := 0
14 LIBUNWIND_LIBS = -lunwind -lunwind-x86 15 LIBUNWIND_LIBS = -lunwind -lunwind-x86
15 endif 16 endif
16 17
17 ifeq ($(ARCH),x86_64) 18 ifeq ($(ARCH),x86_64)
18 override ARCH := x86 19 override ARCH := x86
19 IS_X86_64 := 0 20 IS_X86_64 := 0
20 ifeq (, $(findstring m32,$(EXTRA_CFLAGS))) 21 ifeq (, $(findstring m32,$(CFLAGS)))
21 IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1) 22 IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
22 endif 23 endif
23 ifeq (${IS_X86_64}, 1) 24 ifeq (${IS_X86_64}, 1)
24 RAW_ARCH := x86_64 25 RAW_ARCH := x86_64
25 ARCH_CFLAGS := -DARCH_X86_64 26 CFLAGS += -DARCH_X86_64
26 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S 27 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
27 endif 28 endif
28 NO_PERF_REGS := 0 29 NO_PERF_REGS := 0
29 LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 30 LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
30 endif 31 endif
31 32
32 ifeq ($(NO_PERF_REGS),0) 33 ifeq ($(NO_PERF_REGS),0)
33 BASIC_CFLAGS += -DHAVE_PERF_REGS 34 CFLAGS += -DHAVE_PERF_REGS
34 endif 35 endif
35 36
36 -include config/feature-tests.mak 37 -include config/feature-tests.mak
37 38
38 ifeq ($(call get-executable,$(FLEX)),) 39 ifeq ($(call get-executable,$(FLEX)),)
39 dummy := $(error Error: $(FLEX) is missing on this system, please install it) 40 dummy := $(error Error: $(FLEX) is missing on this system, please install it)
40 endif 41 endif
41 42
42 ifeq ($(call get-executable,$(BISON)),) 43 ifeq ($(call get-executable,$(BISON)),)
43 dummy := $(error Error: $(BISON) is missing on this system, please install it) 44 dummy := $(error Error: $(BISON) is missing on this system, please install it)
44 endif 45 endif
45 46
46 # Treat warnings as errors unless directed not to 47 # Treat warnings as errors unless directed not to
47 ifneq ($(WERROR),0) 48 ifneq ($(WERROR),0)
48 CFLAGS_WERROR := -Werror 49 CFLAGS += -Werror
49 endif 50 endif
50 51
51 ifeq ("$(origin DEBUG)", "command line") 52 ifeq ("$(origin DEBUG)", "command line")
52 PERF_DEBUG = $(DEBUG) 53 PERF_DEBUG = $(DEBUG)
53 endif 54 endif
54 ifndef PERF_DEBUG 55 ifndef PERF_DEBUG
55 CFLAGS_OPTIMIZE = -O6 56 CFLAGS += -O6
56 endif 57 endif
57 58
58 ifdef PARSER_DEBUG 59 ifdef PARSER_DEBUG
59 PARSER_DEBUG_BISON := -t 60 PARSER_DEBUG_BISON := -t
60 PARSER_DEBUG_FLEX := -d 61 PARSER_DEBUG_FLEX := -d
61 PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG 62 CFLAGS += -DPARSER_DEBUG
62 endif 63 endif
63 64
64 CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) 65 CFLAGS += \
66 -fno-omit-frame-pointer \
67 -ggdb3 \
68 -funwind-tables \
69 -Wall \
70 -Wextra \
71 -std=gnu99
72
65 EXTLIBS = -lpthread -lrt -lelf -lm 73 EXTLIBS = -lpthread -lrt -lelf -lm
66 ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
67 ALL_LDFLAGS = $(LDFLAGS) 74 ALL_LDFLAGS = $(LDFLAGS)
68 75
69 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) 76 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
70 CFLAGS := $(CFLAGS) -fstack-protector-all 77 CFLAGS += -fstack-protector-all
71 endif 78 endif
72 79
73 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y) 80 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
74 CFLAGS := $(CFLAGS) -Wstack-protector 81 CFLAGS += -Wstack-protector
75 endif 82 endif
76 83
77 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y) 84 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
78 CFLAGS := $(CFLAGS) -Wvolatile-register-var 85 CFLAGS += -Wvolatile-register-var
79 endif 86 endif
80 87
81 ifndef PERF_DEBUG 88 ifndef PERF_DEBUG
82 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y) 89 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
83 CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2 90 CFLAGS += -D_FORTIFY_SOURCE=2
84 endif 91 endif
85 endif 92 endif
86 93
87 BASIC_CFLAGS += \ 94 CFLAGS += \
88 -Iutil/include \ 95 -Iutil/include \
89 -Iarch/$(ARCH)/include \ 96 -Iarch/$(ARCH)/include \
90 $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \ 97 $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
91 -I$(srctree)/arch/$(ARCH)/include/uapi \ 98 -I$(srctree)/arch/$(ARCH)/include/uapi \
92 -I$(srctree)/arch/$(ARCH)/include \ 99 -I$(srctree)/arch/$(ARCH)/include \
93 $(if $(objtree),-I$(objtree)/include/generated/uapi) \ 100 $(if $(objtree),-I$(objtree)/include/generated/uapi) \
94 -I$(srctree)/include/uapi \ 101 -I$(srctree)/include/uapi \
95 -I$(srctree)/include \ 102 -I$(srctree)/include \
96 -I$(OUTPUT)util \ 103 -I$(OUTPUT)util \
97 -Iutil \ 104 -Iutil \
98 -I. \ 105 -I. \
99 -I$(TRACE_EVENT_DIR) \ 106 -I$(TRACE_EVENT_DIR) \
100 -I../lib/ \ 107 -I../lib/ \
101 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 108 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
102 109
103 BASIC_LDFLAGS = 110 BASIC_LDFLAGS =
104 111
105 ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) 112 ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
106 BIONIC := 1 113 BIONIC := 1
107 EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) 114 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
108 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) 115 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
109 BASIC_CFLAGS += -I.
110 endif 116 endif
111 117
112 ifdef NO_LIBELF 118 ifdef NO_LIBELF
113 NO_DWARF := 1 119 NO_DWARF := 1
114 NO_DEMANGLE := 1 120 NO_DEMANGLE := 1
115 NO_LIBUNWIND := 1 121 NO_LIBUNWIND := 1
116 else 122 else
117 FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) 123 FLAGS_LIBELF=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
118 ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y) 124 ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
119 FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS) 125 FLAGS_GLIBC=$(CFLAGS) $(ALL_LDFLAGS)
120 ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y) 126 ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
121 LIBC_SUPPORT := 1 127 LIBC_SUPPORT := 1
122 endif 128 endif
123 ifeq ($(BIONIC),1) 129 ifeq ($(BIONIC),1)
124 LIBC_SUPPORT := 1 130 LIBC_SUPPORT := 1
125 endif 131 endif
126 ifeq ($(LIBC_SUPPORT),1) 132 ifeq ($(LIBC_SUPPORT),1)
127 msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev); 133 msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
128 134
129 NO_LIBELF := 1 135 NO_LIBELF := 1
130 NO_DWARF := 1 136 NO_DWARF := 1
131 NO_DEMANGLE := 1 137 NO_DEMANGLE := 1
132 else 138 else
133 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 139 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
134 endif 140 endif
135 else 141 else
136 # for linking with debug library, run like: 142 # for linking with debug library, run like:
137 # make DEBUG=1 LIBDW_DIR=/opt/libdw/ 143 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
138 ifdef LIBDW_DIR 144 ifdef LIBDW_DIR
139 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include 145 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
140 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib 146 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
141 endif 147 endif
142 148
143 FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) 149 FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
144 ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y) 150 ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
145 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); 151 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);
146 NO_DWARF := 1 152 NO_DWARF := 1
147 endif # Dwarf support 153 endif # Dwarf support
148 endif # SOURCE_LIBELF 154 endif # SOURCE_LIBELF
149 endif # NO_LIBELF 155 endif # NO_LIBELF
150 156
151 ifndef NO_LIBELF 157 ifndef NO_LIBELF
152 BASIC_CFLAGS += -DLIBELF_SUPPORT 158 CFLAGS += -DLIBELF_SUPPORT
153 FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) 159 FLAGS_LIBELF=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
154 ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y) 160 ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
155 BASIC_CFLAGS += -DLIBELF_MMAP 161 CFLAGS += -DLIBELF_MMAP
156 endif 162 endif
157 163
158 # include ARCH specific config 164 # include ARCH specific config
159 -include arch/$(ARCH)/Makefile 165 -include arch/$(ARCH)/Makefile
160 166
161 ifndef NO_DWARF 167 ifndef NO_DWARF
162 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) 168 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
163 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); 169 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
164 NO_DWARF := 1 170 NO_DWARF := 1
165 else 171 else
166 BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS) 172 CFLAGS += -DDWARF_SUPPORT $(LIBDW_CFLAGS)
167 BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS) 173 BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
168 EXTLIBS += -lelf -ldw 174 EXTLIBS += -lelf -ldw
169 endif # PERF_HAVE_DWARF_REGS 175 endif # PERF_HAVE_DWARF_REGS
170 endif # NO_DWARF 176 endif # NO_DWARF
171 177
172 endif # NO_LIBELF 178 endif # NO_LIBELF
173 179
174 # There's only x86 (both 32 and 64) support for CFI unwind so far 180 # There's only x86 (both 32 and 64) support for CFI unwind so far
175 ifneq ($(ARCH),x86) 181 ifneq ($(ARCH),x86)
176 NO_LIBUNWIND := 1 182 NO_LIBUNWIND := 1
177 endif 183 endif
178 184
179 ifndef NO_LIBUNWIND 185 ifndef NO_LIBUNWIND
180 # for linking with debug library, run like: 186 # for linking with debug library, run like:
181 # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ 187 # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
182 ifdef LIBUNWIND_DIR 188 ifdef LIBUNWIND_DIR
183 LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include 189 LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include
184 LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib 190 LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
185 endif 191 endif
186 192
187 FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) 193 FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
188 ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y) 194 ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
189 msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); 195 msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
190 NO_LIBUNWIND := 1 196 NO_LIBUNWIND := 1
191 endif # Libunwind support 197 endif # Libunwind support
192 endif # NO_LIBUNWIND 198 endif # NO_LIBUNWIND
193 199
194 ifndef NO_LIBUNWIND 200 ifndef NO_LIBUNWIND
195 BASIC_CFLAGS += -DLIBUNWIND_SUPPORT 201 CFLAGS += -DLIBUNWIND_SUPPORT
196 EXTLIBS += $(LIBUNWIND_LIBS) 202 EXTLIBS += $(LIBUNWIND_LIBS)
197 BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS) 203 CFLAGS += $(LIBUNWIND_CFLAGS)
198 BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS) 204 BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
199 endif # NO_LIBUNWIND 205 endif # NO_LIBUNWIND
200 206
201 ifndef NO_LIBAUDIT 207 ifndef NO_LIBAUDIT
202 FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit 208 FLAGS_LIBAUDIT = $(CFLAGS) $(ALL_LDFLAGS) -laudit
203 ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y) 209 ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
204 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); 210 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
205 NO_LIBAUDIT := 1 211 NO_LIBAUDIT := 1
206 else 212 else
207 BASIC_CFLAGS += -DLIBAUDIT_SUPPORT 213 CFLAGS += -DLIBAUDIT_SUPPORT
208 EXTLIBS += -laudit 214 EXTLIBS += -laudit
209 endif 215 endif
210 endif 216 endif
211 217
212 ifdef NO_NEWT 218 ifdef NO_NEWT
213 NO_SLANG=1 219 NO_SLANG=1
214 endif 220 endif
215 221
216 ifndef NO_SLANG 222 ifndef NO_SLANG
217 FLAGS_SLANG=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang 223 FLAGS_SLANG=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
218 ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y) 224 ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y)
219 msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); 225 msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
220 NO_SLANG := 1 226 NO_SLANG := 1
221 else 227 else
222 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h 228 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
223 BASIC_CFLAGS += -I/usr/include/slang 229 CFLAGS += -I/usr/include/slang
224 BASIC_CFLAGS += -DSLANG_SUPPORT 230 CFLAGS += -DSLANG_SUPPORT
225 EXTLIBS += -lslang 231 EXTLIBS += -lslang
226 endif 232 endif
227 endif 233 endif
228 234
229 ifndef NO_GTK2 235 ifndef NO_GTK2
230 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) 236 FLAGS_GTK2=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
231 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y) 237 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
232 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); 238 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
233 NO_GTK2 := 1 239 NO_GTK2 := 1
234 else 240 else
235 ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y) 241 ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
236 BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR 242 CFLAGS += -DHAVE_GTK_INFO_BAR
237 endif 243 endif
238 BASIC_CFLAGS += -DGTK2_SUPPORT 244 CFLAGS += -DGTK2_SUPPORT
239 BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) 245 CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
240 EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) 246 EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
241 endif 247 endif
242 endif 248 endif
243 249
244 grep-libs = $(filter -l%,$(1)) 250 grep-libs = $(filter -l%,$(1))
245 strip-libs = $(filter-out -l%,$(1)) 251 strip-libs = $(filter-out -l%,$(1))
246 252
247 ifdef NO_LIBPERL 253 ifdef NO_LIBPERL
248 BASIC_CFLAGS += -DNO_LIBPERL 254 CFLAGS += -DNO_LIBPERL
249 else 255 else
250 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) 256 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
251 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) 257 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
252 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) 258 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
253 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` 259 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
254 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) 260 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
255 261
256 ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y) 262 ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y)
257 BASIC_CFLAGS += -DNO_LIBPERL 263 CFLAGS += -DNO_LIBPERL
258 NO_LIBPERL := 1 264 NO_LIBPERL := 1
259 else 265 else
260 ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS) 266 ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
261 EXTLIBS += $(PERL_EMBED_LIBADD) 267 EXTLIBS += $(PERL_EMBED_LIBADD)
262 endif 268 endif
263 endif 269 endif
264 270
265 disable-python = $(eval $(disable-python_code)) 271 disable-python = $(eval $(disable-python_code))
266 define disable-python_code 272 define disable-python_code
267 BASIC_CFLAGS += -DNO_LIBPYTHON 273 CFLAGS += -DNO_LIBPYTHON
268 $(if $(1),$(warning No $(1) was found)) 274 $(if $(1),$(warning No $(1) was found))
269 $(warning Python support will not be built) 275 $(warning Python support will not be built)
270 NO_LIBPYTHON := 1 276 NO_LIBPYTHON := 1
271 endef 277 endef
272 278
273 override PYTHON := \ 279 override PYTHON := \
274 $(call get-executable-or-default,PYTHON,python) 280 $(call get-executable-or-default,PYTHON,python)
275 281
276 ifndef PYTHON 282 ifndef PYTHON
277 $(call disable-python,python interpreter) 283 $(call disable-python,python interpreter)
278 else 284 else
279 285
280 PYTHON_WORD := $(call shell-wordify,$(PYTHON)) 286 PYTHON_WORD := $(call shell-wordify,$(PYTHON))
281 287
282 ifdef NO_LIBPYTHON 288 ifdef NO_LIBPYTHON
283 $(call disable-python) 289 $(call disable-python)
284 else 290 else
285 291
286 override PYTHON_CONFIG := \ 292 override PYTHON_CONFIG := \
287 $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config) 293 $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
288 294
289 ifndef PYTHON_CONFIG 295 ifndef PYTHON_CONFIG
290 $(call disable-python,python-config tool) 296 $(call disable-python,python-config tool)
291 else 297 else
292 298
293 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) 299 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
294 300
295 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) 301 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
296 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) 302 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
297 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) 303 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
298 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) 304 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
299 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) 305 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
300 306
301 ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y) 307 ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y)
302 $(call disable-python,Python.h (for Python 2.x)) 308 $(call disable-python,Python.h (for Python 2.x))
303 else 309 else
304 310
305 ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y) 311 ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y)
306 $(warning Python 3 is not yet supported; please set) 312 $(warning Python 3 is not yet supported; please set)
307 $(warning PYTHON and/or PYTHON_CONFIG appropriately.) 313 $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
308 $(warning If you also have Python 2 installed, then) 314 $(warning If you also have Python 2 installed, then)
309 $(warning try something like:) 315 $(warning try something like:)
310 $(warning $(and ,)) 316 $(warning $(and ,))
311 $(warning $(and ,) make PYTHON=python2) 317 $(warning $(and ,) make PYTHON=python2)
312 $(warning $(and ,)) 318 $(warning $(and ,))
313 $(warning Otherwise, disable Python support entirely:) 319 $(warning Otherwise, disable Python support entirely:)
314 $(warning $(and ,)) 320 $(warning $(and ,))
315 $(warning $(and ,) make NO_LIBPYTHON=1) 321 $(warning $(and ,) make NO_LIBPYTHON=1)
316 $(warning $(and ,)) 322 $(warning $(and ,))
317 $(error $(and ,)) 323 $(error $(and ,))
318 else 324 else
319 ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS) 325 ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
320 EXTLIBS += $(PYTHON_EMBED_LIBADD) 326 EXTLIBS += $(PYTHON_EMBED_LIBADD)
321 LANG_BINDINGS += $(OUTPUT)python/perf.so 327 LANG_BINDINGS += $(OUTPUT)python/perf.so
322 endif 328 endif
323 endif 329 endif
324 endif 330 endif
325 endif 331 endif
326 endif 332 endif
327 333
328 ifdef NO_DEMANGLE 334 ifdef NO_DEMANGLE
329 BASIC_CFLAGS += -DNO_DEMANGLE 335 CFLAGS += -DNO_DEMANGLE
330 else 336 else
331 ifdef HAVE_CPLUS_DEMANGLE 337 ifdef HAVE_CPLUS_DEMANGLE
332 EXTLIBS += -liberty 338 EXTLIBS += -liberty
333 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE 339 CFLAGS += -DHAVE_CPLUS_DEMANGLE
334 else 340 else
335 FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd 341 FLAGS_BFD=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
336 has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) 342 has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
337 ifeq ($(has_bfd),y) 343 ifeq ($(has_bfd),y)
338 EXTLIBS += -lbfd 344 EXTLIBS += -lbfd
339 else 345 else
340 FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty 346 FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
341 has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) 347 has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty)
342 ifeq ($(has_bfd_iberty),y) 348 ifeq ($(has_bfd_iberty),y)
343 EXTLIBS += -lbfd -liberty 349 EXTLIBS += -lbfd -liberty
344 else 350 else
345 FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz 351 FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
346 has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz) 352 has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz)
347 ifeq ($(has_bfd_iberty_z),y) 353 ifeq ($(has_bfd_iberty_z),y)
348 EXTLIBS += -lbfd -liberty -lz 354 EXTLIBS += -lbfd -liberty -lz
349 else 355 else
350 FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty 356 FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
351 has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle) 357 has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
352 ifeq ($(has_cplus_demangle),y) 358 ifeq ($(has_cplus_demangle),y)
353 EXTLIBS += -liberty 359 EXTLIBS += -liberty
354 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE 360 CFLAGS += -DHAVE_CPLUS_DEMANGLE
355 else 361 else
356 msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) 362 msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
357 BASIC_CFLAGS += -DNO_DEMANGLE 363 CFLAGS += -DNO_DEMANGLE
358 endif 364 endif
359 endif 365 endif
360 endif 366 endif
361 endif 367 endif
362 endif 368 endif
363 endif 369 endif
364 370
365 ifndef NO_STRLCPY 371 ifndef NO_STRLCPY
366 ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) 372 ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y)
367 BASIC_CFLAGS += -DHAVE_STRLCPY 373 CFLAGS += -DHAVE_STRLCPY
368 endif 374 endif
369 endif 375 endif
370 376
371 ifndef NO_ON_EXIT 377 ifndef NO_ON_EXIT
372 ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y) 378 ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y)
373 BASIC_CFLAGS += -DHAVE_ON_EXIT 379 CFLAGS += -DHAVE_ON_EXIT
374 endif 380 endif
375 endif 381 endif
376 382
377 ifndef NO_BACKTRACE 383 ifndef NO_BACKTRACE
378 ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y) 384 ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
379 BASIC_CFLAGS += -DBACKTRACE_SUPPORT 385 CFLAGS += -DBACKTRACE_SUPPORT
380 endif 386 endif
381 endif 387 endif
382 388
383 ifndef NO_LIBNUMA 389 ifndef NO_LIBNUMA
384 FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma 390 FLAGS_LIBNUMA = $(CFLAGS) $(ALL_LDFLAGS) -lnuma
385 ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y) 391 ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
386 msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); 392 msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
387 NO_LIBNUMA := 1 393 NO_LIBNUMA := 1
388 else 394 else
389 BASIC_CFLAGS += -DLIBNUMA_SUPPORT 395 CFLAGS += -DLIBNUMA_SUPPORT
390 EXTLIBS += -lnuma 396 EXTLIBS += -lnuma
391 endif 397 endif
392 endif 398 endif
393 399
394 # Among the variables below, these: 400 # Among the variables below, these:
395 # perfexecdir 401 # perfexecdir
396 # template_dir 402 # template_dir
397 # mandir 403 # mandir
398 # infodir 404 # infodir
399 # htmldir 405 # htmldir
400 # ETC_PERFCONFIG (but not sysconfdir) 406 # ETC_PERFCONFIG (but not sysconfdir)
401 # can be specified as a relative path some/where/else; 407 # can be specified as a relative path some/where/else;
402 # this is interpreted as relative to $(prefix) and "perf" at 408 # this is interpreted as relative to $(prefix) and "perf" at
403 # runtime figures out where they are based on the path to the executable. 409 # runtime figures out where they are based on the path to the executable.
404 # This can help installing the suite in a relocatable way. 410 # This can help installing the suite in a relocatable way.
405 411
406 # Make the path relative to DESTDIR, not to prefix 412 # Make the path relative to DESTDIR, not to prefix
407 ifndef DESTDIR 413 ifndef DESTDIR
408 prefix = $(HOME) 414 prefix = $(HOME)
409 endif 415 endif
410 bindir_relative = bin 416 bindir_relative = bin
411 bindir = $(prefix)/$(bindir_relative) 417 bindir = $(prefix)/$(bindir_relative)
412 mandir = share/man 418 mandir = share/man
413 infodir = share/info 419 infodir = share/info
414 perfexecdir = libexec/perf-core 420 perfexecdir = libexec/perf-core
415 sharedir = $(prefix)/share 421 sharedir = $(prefix)/share
416 template_dir = share/perf-core/templates 422 template_dir = share/perf-core/templates
417 htmldir = share/doc/perf-doc 423 htmldir = share/doc/perf-doc
418 ifeq ($(prefix),/usr) 424 ifeq ($(prefix),/usr)
419 sysconfdir = /etc 425 sysconfdir = /etc
420 ETC_PERFCONFIG = $(sysconfdir)/perfconfig 426 ETC_PERFCONFIG = $(sysconfdir)/perfconfig
421 else 427 else
422 sysconfdir = $(prefix)/etc 428 sysconfdir = $(prefix)/etc
423 ETC_PERFCONFIG = etc/perfconfig 429 ETC_PERFCONFIG = etc/perfconfig
424 endif 430 endif
425 lib = lib 431 lib = lib
426 432
427 # Shell quote (do not use $(call) to accommodate ancient setups); 433 # Shell quote (do not use $(call) to accommodate ancient setups);
428 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) 434 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
429 DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) 435 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
430 bindir_SQ = $(subst ','\'',$(bindir)) 436 bindir_SQ = $(subst ','\'',$(bindir))
431 mandir_SQ = $(subst ','\'',$(mandir)) 437 mandir_SQ = $(subst ','\'',$(mandir))
432 infodir_SQ = $(subst ','\'',$(infodir)) 438 infodir_SQ = $(subst ','\'',$(infodir))
433 perfexecdir_SQ = $(subst ','\'',$(perfexecdir)) 439 perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
434 template_dir_SQ = $(subst ','\'',$(template_dir)) 440 template_dir_SQ = $(subst ','\'',$(template_dir))
435 htmldir_SQ = $(subst ','\'',$(htmldir)) 441 htmldir_SQ = $(subst ','\'',$(htmldir))
436 prefix_SQ = $(subst ','\'',$(prefix)) 442 prefix_SQ = $(subst ','\'',$(prefix))
437 sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) 443 sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
438 444
439 ifneq ($(filter /%,$(firstword $(perfexecdir))),) 445 ifneq ($(filter /%,$(firstword $(perfexecdir))),)
440 perfexec_instdir = $(perfexecdir) 446 perfexec_instdir = $(perfexecdir)
441 else 447 else
442 perfexec_instdir = $(prefix)/$(perfexecdir) 448 perfexec_instdir = $(prefix)/$(perfexecdir)
443 endif 449 endif
tools/perf/util/setup.py
1 #!/usr/bin/python2 1 #!/usr/bin/python2
2 2
3 from distutils.core import setup, Extension 3 from distutils.core import setup, Extension
4 from os import getenv 4 from os import getenv
5 5
6 from distutils.command.build_ext import build_ext as _build_ext 6 from distutils.command.build_ext import build_ext as _build_ext
7 from distutils.command.install_lib import install_lib as _install_lib 7 from distutils.command.install_lib import install_lib as _install_lib
8 8
9 class build_ext(_build_ext): 9 class build_ext(_build_ext):
10 def finalize_options(self): 10 def finalize_options(self):
11 _build_ext.finalize_options(self) 11 _build_ext.finalize_options(self)
12 self.build_lib = build_lib 12 self.build_lib = build_lib
13 self.build_temp = build_tmp 13 self.build_temp = build_tmp
14 14
15 class install_lib(_install_lib): 15 class install_lib(_install_lib):
16 def finalize_options(self): 16 def finalize_options(self):
17 _install_lib.finalize_options(self) 17 _install_lib.finalize_options(self)
18 self.build_dir = build_lib 18 self.build_dir = build_lib
19 19
20 20
21 cflags = ['-fno-strict-aliasing', '-Wno-write-strings'] 21 cflags = getenv('CFLAGS', '').split()
22 cflags += getenv('CFLAGS', '').split() 22 # switch off several checks (need to be at the end of cflags list)
23 cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
23 24
24 build_lib = getenv('PYTHON_EXTBUILD_LIB') 25 build_lib = getenv('PYTHON_EXTBUILD_LIB')
25 build_tmp = getenv('PYTHON_EXTBUILD_TMP') 26 build_tmp = getenv('PYTHON_EXTBUILD_TMP')
26 libtraceevent = getenv('LIBTRACEEVENT') 27 libtraceevent = getenv('LIBTRACEEVENT')
27 liblk = getenv('LIBLK') 28 liblk = getenv('LIBLK')
28 29
29 ext_sources = [f.strip() for f in file('util/python-ext-sources') 30 ext_sources = [f.strip() for f in file('util/python-ext-sources')
30 if len(f.strip()) > 0 and f[0] != '#'] 31 if len(f.strip()) > 0 and f[0] != '#']
31 32
32 perf = Extension('perf', 33 perf = Extension('perf',
33 sources = ext_sources, 34 sources = ext_sources,
34 include_dirs = ['util/include'], 35 include_dirs = ['util/include'],
35 extra_compile_args = cflags, 36 extra_compile_args = cflags,
36 extra_objects = [libtraceevent, liblk], 37 extra_objects = [libtraceevent, liblk],
37 ) 38 )
38 39
39 setup(name='perf', 40 setup(name='perf',
40 version='0.1', 41 version='0.1',
41 description='Interface with the Linux profiling infrastructure', 42 description='Interface with the Linux profiling infrastructure',
42 author='Arnaldo Carvalho de Melo', 43 author='Arnaldo Carvalho de Melo',
43 author_email='acme@redhat.com', 44 author_email='acme@redhat.com',
44 license='GPLv2', 45 license='GPLv2',
45 url='http://perf.wiki.kernel.org', 46 url='http://perf.wiki.kernel.org',
46 ext_modules=[perf], 47 ext_modules=[perf],
47 cmdclass={'build_ext': build_ext, 'install_lib': install_lib}) 48 cmdclass={'build_ext': build_ext, 'install_lib': install_lib})
48 49