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