xref: /openbmc/linux/tools/perf/util/Build (revision e021ae7f)
1perf-y += arm64-frame-pointer-unwind-support.o
2perf-y += addr_location.o
3perf-y += annotate.o
4perf-y += block-info.o
5perf-y += block-range.o
6perf-y += build-id.o
7perf-y += cacheline.o
8perf-y += config.o
9perf-y += copyfile.o
10perf-y += ctype.o
11perf-y += db-export.o
12perf-y += env.o
13perf-y += event.o
14perf-y += evlist.o
15perf-y += sideband_evlist.o
16perf-y += evsel.o
17perf-y += evsel_fprintf.o
18perf-y += perf_event_attr_fprintf.o
19perf-y += evswitch.o
20perf-y += find_bit.o
21perf-y += get_current_dir_name.o
22perf-y += levenshtein.o
23perf-y += llvm-utils.o
24perf-y += mmap.o
25perf-y += memswap.o
26perf-y += parse-events.o
27perf-y += print-events.o
28perf-y += tracepoint.o
29perf-y += perf_regs.o
30perf-y += path.o
31perf-y += print_binary.o
32perf-y += rlimit.o
33perf-y += argv_split.o
34perf-y += rbtree.o
35perf-y += libstring.o
36perf-y += bitmap.o
37perf-y += hweight.o
38perf-y += smt.o
39perf-y += strbuf.o
40perf-y += string.o
41perf-y += strlist.o
42perf-y += strfilter.o
43perf-y += top.o
44perf-y += usage.o
45perf-y += dso.o
46perf-y += dsos.o
47perf-y += symbol.o
48perf-y += symbol_fprintf.o
49perf-y += color.o
50perf-y += color_config.o
51perf-y += metricgroup.o
52perf-y += header.o
53perf-y += callchain.o
54perf-y += values.o
55perf-y += debug.o
56perf-y += fncache.o
57perf-y += machine.o
58perf-y += map.o
59perf-y += maps.o
60perf-y += pstack.o
61perf-y += session.o
62perf-y += sample-raw.o
63perf-y += s390-sample-raw.o
64perf-y += amd-sample-raw.o
65perf-$(CONFIG_TRACE) += syscalltbl.o
66perf-y += ordered-events.o
67perf-y += namespaces.o
68perf-y += comm.o
69perf-y += thread.o
70perf-y += thread_map.o
71perf-y += parse-events-flex.o
72perf-y += parse-events-bison.o
73perf-y += pmu.o
74perf-y += pmus.o
75perf-y += pmu-flex.o
76perf-y += pmu-bison.o
77perf-y += svghelper.o
78perf-$(CONFIG_LIBTRACEEVENT) += trace-event-info.o
79perf-y += trace-event-scripting.o
80perf-$(CONFIG_LIBTRACEEVENT) += trace-event.o
81perf-$(CONFIG_LIBTRACEEVENT) += trace-event-parse.o
82perf-$(CONFIG_LIBTRACEEVENT) += trace-event-read.o
83perf-y += sort.o
84perf-y += hist.o
85perf-y += util.o
86perf-y += cpumap.o
87perf-y += affinity.o
88perf-y += cputopo.o
89perf-y += cgroup.o
90perf-y += target.o
91perf-y += rblist.o
92perf-y += intlist.o
93perf-y += vdso.o
94perf-y += counts.o
95perf-y += stat.o
96perf-y += stat-shadow.o
97perf-y += stat-display.o
98perf-y += perf_api_probe.o
99perf-y += record.o
100perf-y += srcline.o
101perf-y += srccode.o
102perf-y += synthetic-events.o
103perf-y += data.o
104perf-y += tsc.o
105perf-y += cloexec.o
106perf-y += call-path.o
107perf-y += rwsem.o
108perf-y += thread-stack.o
109perf-y += spark.o
110perf-y += topdown.o
111perf-y += iostat.o
112perf-y += stream.o
113perf-$(CONFIG_AUXTRACE) += auxtrace.o
114perf-$(CONFIG_AUXTRACE) += intel-pt-decoder/
115perf-$(CONFIG_AUXTRACE) += intel-pt.o
116perf-$(CONFIG_AUXTRACE) += intel-bts.o
117perf-$(CONFIG_AUXTRACE) += arm-spe.o
118perf-$(CONFIG_AUXTRACE) += arm-spe-decoder/
119perf-$(CONFIG_AUXTRACE) += hisi-ptt.o
120perf-$(CONFIG_AUXTRACE) += hisi-ptt-decoder/
121perf-$(CONFIG_AUXTRACE) += s390-cpumsf.o
122
123ifdef CONFIG_LIBOPENCSD
124perf-$(CONFIG_AUXTRACE) += cs-etm.o
125perf-$(CONFIG_AUXTRACE) += cs-etm-decoder/
126endif
127perf-$(CONFIG_AUXTRACE) += cs-etm-base.o
128
129perf-y += parse-branch-options.o
130perf-y += dump-insn.o
131perf-y += parse-regs-options.o
132perf-y += parse-sublevel-options.o
133perf-y += term.o
134perf-y += help-unknown-cmd.o
135perf-y += dlfilter.o
136perf-y += mem-events.o
137perf-y += vsprintf.o
138perf-y += units.o
139perf-y += time-utils.o
140perf-y += expr-flex.o
141perf-y += expr-bison.o
142perf-y += expr.o
143perf-y += branch.o
144perf-y += mem2node.o
145perf-y += clockid.o
146perf-y += list_sort.o
147perf-y += mutex.o
148perf-y += sharded_mutex.o
149
150perf-$(CONFIG_LIBBPF) += bpf-loader.o
151perf-$(CONFIG_LIBBPF) += bpf_map.o
152perf-$(CONFIG_PERF_BPF_SKEL) += bpf_counter.o
153perf-$(CONFIG_PERF_BPF_SKEL) += bpf_counter_cgroup.o
154perf-$(CONFIG_PERF_BPF_SKEL) += bpf_ftrace.o
155perf-$(CONFIG_PERF_BPF_SKEL) += bpf_off_cpu.o
156perf-$(CONFIG_PERF_BPF_SKEL) += bpf-filter.o
157perf-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-flex.o
158perf-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-bison.o
159
160ifeq ($(CONFIG_LIBTRACEEVENT),y)
161  perf-$(CONFIG_PERF_BPF_SKEL) += bpf_lock_contention.o
162endif
163
164ifeq ($(CONFIG_LIBTRACEEVENT),y)
165  perf-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork.o
166endif
167
168perf-$(CONFIG_BPF_PROLOGUE) += bpf-prologue.o
169perf-$(CONFIG_LIBELF) += symbol-elf.o
170perf-$(CONFIG_LIBELF) += probe-file.o
171perf-$(CONFIG_LIBELF) += probe-event.o
172
173ifdef CONFIG_LIBBPF_DYNAMIC
174  hashmap := 1
175endif
176ifndef CONFIG_LIBBPF
177  hashmap := 1
178endif
179
180ifdef hashmap
181perf-y += hashmap.o
182endif
183
184ifndef CONFIG_LIBELF
185perf-y += symbol-minimal.o
186endif
187
188ifndef CONFIG_SETNS
189perf-y += setns.o
190endif
191
192perf-$(CONFIG_DWARF) += probe-finder.o
193perf-$(CONFIG_DWARF) += dwarf-aux.o
194perf-$(CONFIG_DWARF) += dwarf-regs.o
195
196perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
197perf-$(CONFIG_LOCAL_LIBUNWIND)    += unwind-libunwind-local.o
198perf-$(CONFIG_LIBUNWIND)          += unwind-libunwind.o
199perf-$(CONFIG_LIBUNWIND_X86)      += libunwind/x86_32.o
200perf-$(CONFIG_LIBUNWIND_AARCH64)  += libunwind/arm64.o
201
202ifeq ($(CONFIG_LIBTRACEEVENT),y)
203  perf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o
204endif
205
206perf-y += data-convert-json.o
207
208perf-y += scripting-engines/
209
210perf-$(CONFIG_ZLIB) += zlib.o
211perf-$(CONFIG_LZMA) += lzma.o
212perf-$(CONFIG_ZSTD) += zstd.o
213
214perf-$(CONFIG_LIBCAP) += cap.o
215
216perf-$(CONFIG_CXX_DEMANGLE) += demangle-cxx.o
217perf-y += demangle-ocaml.o
218perf-y += demangle-java.o
219perf-y += demangle-rust.o
220
221ifdef CONFIG_JITDUMP
222perf-$(CONFIG_LIBELF) += jitdump.o
223perf-$(CONFIG_LIBELF) += genelf.o
224perf-$(CONFIG_DWARF) += genelf_debug.o
225endif
226
227perf-y += perf-hooks.o
228
229perf-$(CONFIG_LIBBPF) += bpf-event.o
230perf-$(CONFIG_LIBBPF) += bpf-utils.o
231
232perf-$(CONFIG_CXX) += c++/
233
234perf-$(CONFIG_LIBPFM4) += pfm.o
235
236CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
237CFLAGS_llvm-utils.o += -DLIBBPF_INCLUDE_DIR="BUILD_STR($(libbpf_include_dir_SQ))"
238
239# avoid compiler warnings in 32-bit mode
240CFLAGS_genelf_debug.o  += -Wno-packed
241
242$(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
243	$(call rule_mkdir)
244	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \
245		--header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) $<
246
247$(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/parse-events-bison.h: util/parse-events.y
248	$(call rule_mkdir)
249	$(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
250		-o $(OUTPUT)util/parse-events-bison.c -p parse_events_
251
252$(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-flex.h: util/expr.l $(OUTPUT)util/expr-bison.c
253	$(call rule_mkdir)
254	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/expr-flex.c \
255		--header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) $<
256
257$(OUTPUT)util/expr-bison.c $(OUTPUT)util/expr-bison.h: util/expr.y
258	$(call rule_mkdir)
259	$(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
260		-o $(OUTPUT)util/expr-bison.c -p expr_
261
262$(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-flex.h: util/pmu.l $(OUTPUT)util/pmu-bison.c
263	$(call rule_mkdir)
264	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/pmu-flex.c \
265		--header-file=$(OUTPUT)util/pmu-flex.h $(PARSER_DEBUG_FLEX) $<
266
267$(OUTPUT)util/pmu-bison.c $(OUTPUT)util/pmu-bison.h: util/pmu.y
268	$(call rule_mkdir)
269	$(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
270		-o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
271
272$(OUTPUT)util/bpf-filter-flex.c $(OUTPUT)util/bpf-filter-flex.h: util/bpf-filter.l $(OUTPUT)util/bpf-filter-bison.c
273	$(call rule_mkdir)
274	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/bpf-filter-flex.c \
275		--header-file=$(OUTPUT)util/bpf-filter-flex.h $(PARSER_DEBUG_FLEX) $<
276
277$(OUTPUT)util/bpf-filter-bison.c $(OUTPUT)util/bpf-filter-bison.h: util/bpf-filter.y
278	$(call rule_mkdir)
279	$(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
280		-o $(OUTPUT)util/bpf-filter-bison.c -p perf_bpf_filter_
281
282FLEX_GE_26 := $(shell expr $(shell $(FLEX) --version | sed -e  's/flex \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 26)
283ifeq ($(FLEX_GE_26),1)
284  flex_flags := -Wno-switch-enum -Wno-switch-default -Wno-unused-function -Wno-redundant-decls -Wno-sign-compare -Wno-unused-parameter -Wno-missing-prototypes -Wno-missing-declarations
285  CC_HASNT_MISLEADING_INDENTATION := $(shell echo "int main(void) { return 0 }" | $(CC) -Werror -Wno-misleading-indentation -o /dev/null -xc - 2>&1 | grep -q -- -Wno-misleading-indentation ; echo $$?)
286  ifeq ($(CC_HASNT_MISLEADING_INDENTATION), 1)
287    flex_flags += -Wno-misleading-indentation
288  endif
289else
290  flex_flags := -w
291endif
292CFLAGS_parse-events-flex.o  += $(flex_flags)
293CFLAGS_pmu-flex.o           += $(flex_flags)
294CFLAGS_expr-flex.o          += $(flex_flags)
295CFLAGS_bpf-filter-flex.o    += $(flex_flags)
296
297bison_flags := -DYYENABLE_NLS=0
298BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35)
299ifeq ($(BISON_GE_35),1)
300  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable -Wno-unknown-warning-option
301else
302  bison_flags += -w
303endif
304CFLAGS_parse-events-bison.o += $(bison_flags)
305CFLAGS_pmu-bison.o          += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
306CFLAGS_expr-bison.o         += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
307CFLAGS_bpf-filter-bison.o   += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
308
309$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
310$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
311$(OUTPUT)util/expr.o: $(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-bison.c
312$(OUTPUT)util/bpf-filter.o: $(OUTPUT)util/bpf-filter-flex.c $(OUTPUT)util/bpf-filter-bison.c
313
314CFLAGS_bitmap.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
315CFLAGS_find_bit.o      += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
316CFLAGS_rbtree.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
317CFLAGS_libstring.o     += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
318CFLAGS_hweight.o       += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
319CFLAGS_parse-events.o  += -Wno-redundant-decls
320CFLAGS_expr.o          += -Wno-redundant-decls
321CFLAGS_header.o        += -include $(OUTPUT)PERF-VERSION-FILE
322CFLAGS_arm-spe.o       += -I$(srctree)/tools/arch/arm64/include/
323
324$(OUTPUT)util/argv_split.o: ../lib/argv_split.c FORCE
325	$(call rule_mkdir)
326	$(call if_changed_dep,cc_o_c)
327
328$(OUTPUT)util/bitmap.o: ../lib/bitmap.c FORCE
329	$(call rule_mkdir)
330	$(call if_changed_dep,cc_o_c)
331
332$(OUTPUT)util/ctype.o: ../lib/ctype.c FORCE
333	$(call rule_mkdir)
334	$(call if_changed_dep,cc_o_c)
335
336$(OUTPUT)util/find_bit.o: ../lib/find_bit.c FORCE
337	$(call rule_mkdir)
338	$(call if_changed_dep,cc_o_c)
339
340$(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE
341	$(call rule_mkdir)
342	$(call if_changed_dep,cc_o_c)
343
344$(OUTPUT)util/libstring.o: ../lib/string.c FORCE
345	$(call rule_mkdir)
346	$(call if_changed_dep,cc_o_c)
347
348$(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE
349	$(call rule_mkdir)
350	$(call if_changed_dep,cc_o_c)
351
352$(OUTPUT)util/vsprintf.o: ../lib/vsprintf.c FORCE
353	$(call rule_mkdir)
354	$(call if_changed_dep,cc_o_c)
355
356$(OUTPUT)util/list_sort.o: ../lib/list_sort.c FORCE
357	$(call rule_mkdir)
358	$(call if_changed_dep,cc_o_c)
359