xref: /linux/tools/perf/util/Build (revision 88c51002d06f9a68a2b666f7e2c262b6e198f566)
1878460e8SArnaldo Carvalho de Meloinclude $(srctree)/tools/scripts/Makefile.include
210c775afSIan Rogersinclude $(srctree)/tools/scripts/utilities.mak
310c775afSIan Rogers
4e467705aSIan Rogersperf-util-y += arm64-frame-pointer-unwind-support.o
5257046a3SIan Rogersperf-util-y += addr2line.o
6e467705aSIan Rogersperf-util-y += addr_location.o
7e467705aSIan Rogersperf-util-y += annotate.o
8e467705aSIan Rogersperf-util-y += block-info.o
9e467705aSIan Rogersperf-util-y += block-range.o
10e467705aSIan Rogersperf-util-y += build-id.o
11e467705aSIan Rogersperf-util-y += cacheline.o
12bbb99668SIan Rogersperf-util-y += capstone.o
13e467705aSIan Rogersperf-util-y += config.o
14e467705aSIan Rogersperf-util-y += copyfile.o
15e467705aSIan Rogersperf-util-y += ctype.o
16e467705aSIan Rogersperf-util-y += db-export.o
17e467705aSIan Rogersperf-util-y += disasm.o
18e467705aSIan Rogersperf-util-y += env.o
19e467705aSIan Rogersperf-util-y += event.o
20e467705aSIan Rogersperf-util-y += evlist.o
21e467705aSIan Rogersperf-util-y += sideband_evlist.o
22e467705aSIan Rogersperf-util-y += evsel.o
23e467705aSIan Rogersperf-util-y += evsel_fprintf.o
24e467705aSIan Rogersperf-util-y += perf_event_attr_fprintf.o
25e467705aSIan Rogersperf-util-y += evswitch.o
26e467705aSIan Rogersperf-util-y += find_bit.o
27e467705aSIan Rogersperf-util-y += levenshtein.o
2895931d9aSIan Rogersperf-util-$(CONFIG_LIBBFD) += libbfd.o
29d9007afcSIan Rogersperf-util-y += llvm.o
30e467705aSIan Rogersperf-util-y += mmap.o
31e467705aSIan Rogersperf-util-y += memswap.o
32e467705aSIan Rogersperf-util-y += parse-events.o
33e467705aSIan Rogersperf-util-y += print-events.o
34e467705aSIan Rogersperf-util-y += tracepoint.o
35e467705aSIan Rogersperf-util-y += perf_regs.o
36e467705aSIan Rogersperf-util-y += perf-regs-arch/
37e467705aSIan Rogersperf-util-y += path.o
38e467705aSIan Rogersperf-util-y += print_binary.o
39e467705aSIan Rogersperf-util-y += print_insn.o
40e467705aSIan Rogersperf-util-y += rlimit.o
41e467705aSIan Rogersperf-util-y += argv_split.o
42e467705aSIan Rogersperf-util-y += rbtree.o
43e467705aSIan Rogersperf-util-y += libstring.o
44e467705aSIan Rogersperf-util-y += bitmap.o
45e467705aSIan Rogersperf-util-y += hweight.o
4643830468SEric Biggersperf-util-y += sha1.o
47e467705aSIan Rogersperf-util-y += smt.o
48e467705aSIan Rogersperf-util-y += strbuf.o
49e467705aSIan Rogersperf-util-y += string.o
50e467705aSIan Rogersperf-util-y += strlist.o
51e467705aSIan Rogersperf-util-y += strfilter.o
52e467705aSIan Rogersperf-util-y += top.o
53e467705aSIan Rogersperf-util-y += usage.o
54e467705aSIan Rogersperf-util-y += dso.o
55e467705aSIan Rogersperf-util-y += dsos.o
56e467705aSIan Rogersperf-util-y += symbol.o
57e467705aSIan Rogersperf-util-y += symbol_fprintf.o
58e467705aSIan Rogersperf-util-y += map_symbol.o
59e467705aSIan Rogersperf-util-y += color.o
60e467705aSIan Rogersperf-util-y += color_config.o
61e467705aSIan Rogersperf-util-y += metricgroup.o
62e467705aSIan Rogersperf-util-y += header.o
63e467705aSIan Rogersperf-util-y += callchain.o
64e467705aSIan Rogersperf-util-y += values.o
65e467705aSIan Rogersperf-util-y += debug.o
66e467705aSIan Rogersperf-util-y += fncache.o
67e467705aSIan Rogersperf-util-y += machine.o
68e467705aSIan Rogersperf-util-y += map.o
69e467705aSIan Rogersperf-util-y += maps.o
70e467705aSIan Rogersperf-util-y += pstack.o
71e467705aSIan Rogersperf-util-y += session.o
72564e5cbcSIan Rogersperf-util-y += tool.o
73dc6d2bc2SIan Rogersperf-util-y += sample.o
74e467705aSIan Rogersperf-util-y += sample-raw.o
75e467705aSIan Rogersperf-util-y += s390-sample-raw.o
76e467705aSIan Rogersperf-util-y += amd-sample-raw.o
77e467705aSIan Rogersperf-util-$(CONFIG_TRACE) += syscalltbl.o
78e467705aSIan Rogersperf-util-y += ordered-events.o
79e467705aSIan Rogersperf-util-y += namespaces.o
80e467705aSIan Rogersperf-util-y += comm.o
81e467705aSIan Rogersperf-util-y += thread.o
82e467705aSIan Rogersperf-util-y += threads.o
83e467705aSIan Rogersperf-util-y += thread_map.o
84e467705aSIan Rogersperf-util-y += parse-events-flex.o
85e467705aSIan Rogersperf-util-y += parse-events-bison.o
86e467705aSIan Rogersperf-util-y += pmu.o
87e467705aSIan Rogersperf-util-y += pmus.o
88e467705aSIan Rogersperf-util-y += pmu-flex.o
89e467705aSIan Rogersperf-util-y += pmu-bison.o
9028917cb1SIan Rogersperf-util-y += drm_pmu.o
914810b761SIan Rogersperf-util-y += hwmon_pmu.o
92240505b2SIan Rogersperf-util-y += tool_pmu.o
93d002aab8SIan Rogersperf-util-y += tp_pmu.o
94e467705aSIan Rogersperf-util-y += svghelper.o
95800c93ffSIan Rogersperf-util-y += trace-event-info.o
96e467705aSIan Rogersperf-util-y += trace-event-scripting.o
97e467705aSIan Rogersperf-util-$(CONFIG_LIBTRACEEVENT) += trace-event.o
98e467705aSIan Rogersperf-util-$(CONFIG_LIBTRACEEVENT) += trace-event-parse.o
99e467705aSIan Rogersperf-util-$(CONFIG_LIBTRACEEVENT) += trace-event-read.o
100e467705aSIan Rogersperf-util-y += sort.o
101e467705aSIan Rogersperf-util-y += hist.o
102e467705aSIan Rogersperf-util-y += util.o
103e467705aSIan Rogersperf-util-y += cpumap.o
104e467705aSIan Rogersperf-util-y += affinity.o
105e467705aSIan Rogersperf-util-y += cputopo.o
106e467705aSIan Rogersperf-util-y += cgroup.o
107e467705aSIan Rogersperf-util-y += target.o
108e467705aSIan Rogersperf-util-y += rblist.o
109e467705aSIan Rogersperf-util-y += intlist.o
110e467705aSIan Rogersperf-util-y += vdso.o
111e467705aSIan Rogersperf-util-y += counts.o
112e467705aSIan Rogersperf-util-y += stat.o
113e467705aSIan Rogersperf-util-y += stat-shadow.o
114e467705aSIan Rogersperf-util-y += stat-display.o
115e467705aSIan Rogersperf-util-y += perf_api_probe.o
116e467705aSIan Rogersperf-util-y += record.o
117e467705aSIan Rogersperf-util-y += srcline.o
118e467705aSIan Rogersperf-util-y += srccode.o
119e467705aSIan Rogersperf-util-y += synthetic-events.o
120e467705aSIan Rogersperf-util-y += data.o
121e467705aSIan Rogersperf-util-y += tsc.o
122e467705aSIan Rogersperf-util-y += cloexec.o
123e467705aSIan Rogersperf-util-y += call-path.o
124e467705aSIan Rogersperf-util-y += rwsem.o
125e467705aSIan Rogersperf-util-y += thread-stack.o
126e467705aSIan Rogersperf-util-y += spark.o
127e467705aSIan Rogersperf-util-y += topdown.o
128e467705aSIan Rogersperf-util-y += iostat.o
129e467705aSIan Rogersperf-util-y += stream.o
1303f188942SIan Rogersperf-util-y += kvm-stat.o
1311a12ed09SIan Rogersperf-util-y += lock-contention.o
132754187adSIan Rogersperf-util-y += auxtrace.o
133e7bb49e3SIan Rogersperf-util-y += intel-pt-decoder/
134754187adSIan Rogersperf-util-y += intel-pt.o
135754187adSIan Rogersperf-util-y += intel-bts.o
136754187adSIan Rogersperf-util-y += arm-spe.o
137754187adSIan Rogersperf-util-y += arm-spe-decoder/
138754187adSIan Rogersperf-util-y += hisi-ptt.o
139754187adSIan Rogersperf-util-y += hisi-ptt-decoder/
140754187adSIan Rogersperf-util-y += s390-cpumsf.o
141754187adSIan Rogersperf-util-y += powerpc-vpadtl.o
142440a23b3SMathieu Poirier
143440a23b3SMathieu Poirierifdef CONFIG_LIBOPENCSD
144754187adSIan Rogersperf-util-y += cs-etm.o
145754187adSIan Rogersperf-util-y += cs-etm-decoder/
146440a23b3SMathieu Poirierendif
147754187adSIan Rogersperf-util-y += cs-etm-base.o
148440a23b3SMathieu Poirier
149e467705aSIan Rogersperf-util-y += parse-branch-options.o
150e467705aSIan Rogersperf-util-y += dump-insn.o
151e467705aSIan Rogersperf-util-y += parse-regs-options.o
152e467705aSIan Rogersperf-util-y += parse-sublevel-options.o
153e467705aSIan Rogersperf-util-y += term.o
154e467705aSIan Rogersperf-util-y += help-unknown-cmd.o
155e467705aSIan Rogersperf-util-y += dlfilter.o
156e467705aSIan Rogersperf-util-y += mem-events.o
157e467705aSIan Rogersperf-util-y += mem-info.o
158e467705aSIan Rogersperf-util-y += vsprintf.o
159e467705aSIan Rogersperf-util-y += units.o
160e467705aSIan Rogersperf-util-y += time-utils.o
161e467705aSIan Rogersperf-util-y += expr-flex.o
162e467705aSIan Rogersperf-util-y += expr-bison.o
163e467705aSIan Rogersperf-util-y += expr.o
164e467705aSIan Rogersperf-util-y += branch.o
165e467705aSIan Rogersperf-util-y += mem2node.o
166e467705aSIan Rogersperf-util-y += clockid.o
167e467705aSIan Rogersperf-util-y += list_sort.o
168e467705aSIan Rogersperf-util-y += mutex.o
169e467705aSIan Rogersperf-util-y += sharded_mutex.o
170eb493c28SIan Rogersperf-util-y += intel-tpebs.o
1719352aabaSJiri Olsa
172e467705aSIan Rogersperf-util-$(CONFIG_LIBBPF) += bpf_map.o
173e467705aSIan Rogersperf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_counter.o
174e467705aSIan Rogersperf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_counter_cgroup.o
175e467705aSIan Rogersperf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_ftrace.o
176e467705aSIan Rogersperf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_off_cpu.o
177e467705aSIan Rogersperf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter.o
178e467705aSIan Rogersperf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-flex.o
179e467705aSIan Rogersperf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-bison.o
180dcf90042SArnaldo Carvalho de Meloperf-util-$(CONFIG_PERF_BPF_SKEL) += btf.o
18116cad1d3SNamhyung Kim
1821bec43f5SNamhyung Kimifeq ($(CONFIG_TRACE),y)
1831bec43f5SNamhyung Kim  perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-trace-summary.o
184f6109fb6SNamhyung Kim  perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_trace_augment.o
1851bec43f5SNamhyung Kimendif
1861bec43f5SNamhyung Kim
18716cad1d3SNamhyung Kimifeq ($(CONFIG_LIBTRACEEVENT),y)
188e467705aSIan Rogers  perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_lock_contention.o
18916cad1d3SNamhyung Kimendif
190378ef0f5SIan Rogers
191378ef0f5SIan Rogersifeq ($(CONFIG_LIBTRACEEVENT),y)
192e467705aSIan Rogers  perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork.o
193e467705aSIan Rogers  perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork_top.o
194378ef0f5SIan Rogersendif
195378ef0f5SIan Rogers
196e467705aSIan Rogersperf-util-$(CONFIG_LIBELF) += symbol-elf.o
197e467705aSIan Rogersperf-util-$(CONFIG_LIBELF) += probe-file.o
198e467705aSIan Rogersperf-util-$(CONFIG_LIBELF) += probe-event.o
199709e6791SJiri Olsa
200ad1237c3SJiri Olsaifdef CONFIG_LIBBPF_DYNAMIC
201ad1237c3SJiri Olsa  hashmap := 1
202ad1237c3SJiri Olsaendif
203eee19501SIan Rogersifndef CONFIG_LIBBPF
204ad1237c3SJiri Olsa  hashmap := 1
205ad1237c3SJiri Olsaendif
206ad1237c3SJiri Olsa
207ad1237c3SJiri Olsaifdef hashmap
208e467705aSIan Rogersperf-util-y += hashmap.o
209eee19501SIan Rogersendif
210eee19501SIan Rogers
211709e6791SJiri Olsaifndef CONFIG_LIBELF
212e467705aSIan Rogersperf-util-y += symbol-minimal.o
213709e6791SJiri Olsaendif
214709e6791SJiri Olsa
21586bcdb5aSArnaldo Carvalho de Meloifndef CONFIG_SETNS
216e467705aSIan Rogersperf-util-y += setns.o
21786bcdb5aSArnaldo Carvalho de Meloendif
21886bcdb5aSArnaldo Carvalho de Melo
2195455d89bSIan Rogersperf-util-$(CONFIG_LIBDW) += probe-finder.o
2205455d89bSIan Rogersperf-util-$(CONFIG_LIBDW) += dwarf-aux.o
2215455d89bSIan Rogersperf-util-$(CONFIG_LIBDW) += dwarf-regs.o
222d4a0c4f2SIan Rogersperf-util-$(CONFIG_LIBDW) += dwarf-regs-csky.o
223285b523cSIan Rogersperf-util-$(CONFIG_LIBDW) += dwarf-regs-powerpc.o
224bf4e799aSIan Rogersperf-util-$(CONFIG_LIBDW) += dwarf-regs-x86.o
2255455d89bSIan Rogersperf-util-$(CONFIG_LIBDW) += debuginfo.o
2265455d89bSIan Rogersperf-util-$(CONFIG_LIBDW) += annotate-data.o
227*88c51002SIan Rogersperf-util-$(CONFIG_LIBDW) += libdw.o
2288379fce4SJiri Olsa
229e467705aSIan Rogersperf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
230e467705aSIan Rogersperf-util-$(CONFIG_LOCAL_LIBUNWIND)    += unwind-libunwind-local.o
231e467705aSIan Rogersperf-util-$(CONFIG_LIBUNWIND)          += unwind-libunwind.o
232e467705aSIan Rogersperf-util-$(CONFIG_LIBUNWIND_X86)      += libunwind/x86_32.o
233e467705aSIan Rogersperf-util-$(CONFIG_LIBUNWIND_AARCH64)  += libunwind/arm64.o
234b2e45c32SJiri Olsa
235378ef0f5SIan Rogersifeq ($(CONFIG_LIBTRACEEVENT),y)
236e467705aSIan Rogers  perf-util-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o
237378ef0f5SIan Rogersendif
238378ef0f5SIan Rogers
239e467705aSIan Rogersperf-util-y += data-convert-json.o
240edbe9817SJiri Olsa
241e467705aSIan Rogersperf-util-y += scripting-engines/
242c7355f84SJiri Olsa
243e467705aSIan Rogersperf-util-$(CONFIG_ZLIB) += zlib.o
244e467705aSIan Rogersperf-util-$(CONFIG_LZMA) += lzma.o
245e467705aSIan Rogersperf-util-$(CONFIG_ZSTD) += zstd.o
246f24c1d75SAlexey Budankov
247e25ebda7SIan Rogersperf-util-y += cap.o
248c22e150eSIgor Lubashev
249e467705aSIan Rogersperf-util-$(CONFIG_CXX_DEMANGLE) += demangle-cxx.o
250e467705aSIan Rogersperf-util-y += demangle-ocaml.o
251e467705aSIan Rogersperf-util-y += demangle-java.o
252e20848c3SIan Rogersperf-util-y += demangle-rust-v0.o
253c3f8644cSSteinar H. Gundersonperf-util-$(CONFIG_LIBLLVM) += llvm-c-helpers.o
25446dad054SArnaldo Carvalho de Melo
255e20848c3SIan RogersCFLAGS_demangle-rust-v0.o += -Wno-shadow -Wno-declaration-after-statement \
256e20848c3SIan Rogers    -Wno-switch-default -Wno-switch-enum -Wno-missing-field-initializers
257e20848c3SIan Rogers
258e12b202fSJiri Olsaifdef CONFIG_JITDUMP
259e467705aSIan Rogersperf-util-$(CONFIG_LIBELF) += jitdump.o
260e467705aSIan Rogersperf-util-$(CONFIG_LIBELF) += genelf.o
2615455d89bSIan Rogersperf-util-$(CONFIG_LIBDW) += genelf_debug.o
26246dad054SArnaldo Carvalho de Meloendif
2633bc3374cSJiri Olsa
264e467705aSIan Rogersperf-util-y += perf-hooks.o
265a074865eSWang Nan
266e467705aSIan Rogersperf-util-$(CONFIG_LIBBPF) += bpf-event.o
267e467705aSIan Rogersperf-util-$(CONFIG_LIBBPF) += bpf-utils.o
26845178a92SSong Liu
269e467705aSIan Rogersperf-util-$(CONFIG_LIBPFM4) += pfm.o
27070943490SStephane Eranian
2719352aabaSJiri OlsaCFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
2721b16fffaSArnaldo Carvalho de Melo
273598b7c69SStephane Eranian# avoid compiler warnings in 32-bit mode
274598b7c69SStephane EranianCFLAGS_genelf_debug.o  += -Wno-packed
2759352aabaSJiri Olsa
2764b971df9SIan Rogers$(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
2771999307bSJiri Olsa	$(call rule_mkdir)
2784b971df9SIan Rogers	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \
2794b971df9SIan Rogers		--header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) $<
2809352aabaSJiri Olsa
281ef9894d9SIan Rogers$(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/parse-events-bison.h: util/parse-events.y
2821999307bSJiri Olsa	$(call rule_mkdir)
2839462e4deSIan Rogers	$(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) $(BISON_FALLBACK_FLAGS) \
284ef9894d9SIan Rogers		-o $(OUTPUT)util/parse-events-bison.c -p parse_events_
2859352aabaSJiri Olsa
2864b971df9SIan Rogers$(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-flex.h: util/expr.l $(OUTPUT)util/expr-bison.c
28726226a97SJiri Olsa	$(call rule_mkdir)
2884b971df9SIan Rogers	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/expr-flex.c \
2894b971df9SIan Rogers		--header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) $<
29026226a97SJiri Olsa
291ef9894d9SIan Rogers$(OUTPUT)util/expr-bison.c $(OUTPUT)util/expr-bison.h: util/expr.y
29207516736SAndi Kleen	$(call rule_mkdir)
2936793672aSDenys Zagorui	$(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
294ef9894d9SIan Rogers		-o $(OUTPUT)util/expr-bison.c -p expr_
29507516736SAndi Kleen
2964b971df9SIan Rogers$(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-flex.h: util/pmu.l $(OUTPUT)util/pmu-bison.c
2971999307bSJiri Olsa	$(call rule_mkdir)
2984b971df9SIan Rogers	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/pmu-flex.c \
2994b971df9SIan Rogers		--header-file=$(OUTPUT)util/pmu-flex.h $(PARSER_DEBUG_FLEX) $<
3009352aabaSJiri Olsa
301ef9894d9SIan Rogers$(OUTPUT)util/pmu-bison.c $(OUTPUT)util/pmu-bison.h: util/pmu.y
3021999307bSJiri Olsa	$(call rule_mkdir)
3036793672aSDenys Zagorui	$(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
304ef9894d9SIan Rogers		-o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
3059352aabaSJiri Olsa
306591156f2SNamhyung Kim$(OUTPUT)util/bpf-filter-flex.c $(OUTPUT)util/bpf-filter-flex.h: util/bpf-filter.l $(OUTPUT)util/bpf-filter-bison.c util/bpf-filter.h util/bpf_skel/sample-filter.h
307990a71e9SNamhyung Kim	$(call rule_mkdir)
308990a71e9SNamhyung Kim	$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/bpf-filter-flex.c \
309990a71e9SNamhyung Kim		--header-file=$(OUTPUT)util/bpf-filter-flex.h $(PARSER_DEBUG_FLEX) $<
310990a71e9SNamhyung Kim
311591156f2SNamhyung Kim$(OUTPUT)util/bpf-filter-bison.c $(OUTPUT)util/bpf-filter-bison.h: util/bpf-filter.y util/bpf-filter.h util/bpf_skel/sample-filter.h
312990a71e9SNamhyung Kim	$(call rule_mkdir)
313990a71e9SNamhyung Kim	$(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
314990a71e9SNamhyung Kim		-o $(OUTPUT)util/bpf-filter-bison.c -p perf_bpf_filter_
315990a71e9SNamhyung Kim
31610c775afSIan RogersFLEX_VERSION := $(shell $(FLEX) --version | cut -d' ' -f2)
31710c775afSIan Rogers
31810c775afSIan RogersFLEX_GE_260 := $(call version-ge3,$(FLEX_VERSION),2.6.0)
31910c775afSIan Rogersifeq ($(FLEX_GE_260),1)
32010c775afSIan Rogers  flex_flags := -Wno-redundant-decls -Wno-switch-default -Wno-unused-function -Wno-misleading-indentation
32110c775afSIan Rogers
32210c775afSIan Rogers  # Some newer clang and gcc version complain about this
32310c775afSIan Rogers  # util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
32410c775afSIan Rogers  #  int yynerrs = 0;
32510c775afSIan Rogers
32610c775afSIan Rogers  flex_flags += -Wno-unused-but-set-variable
32710c775afSIan Rogers
32810c775afSIan Rogers  FLEX_LT_262 := $(call version-lt3,$(FLEX_VERSION),2.6.2)
32910c775afSIan Rogers  ifeq ($(FLEX_LT_262),1)
33010c775afSIan Rogers    flex_flags += -Wno-sign-compare
331304d7a90SIan Rogers  endif
332304d7a90SIan Rogerselse
333304d7a90SIan Rogers  flex_flags := -w
334304d7a90SIan Rogersendif
33510c775afSIan Rogers
336ddc8e4c9SIan Rogers# Some newer clang and gcc version complain about this
337ddc8e4c9SIan Rogers# util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
338ddc8e4c9SIan Rogers#  int yynerrs = 0;
339ddc8e4c9SIan Rogers
340ddc8e4c9SIan Rogersbison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable
341878460e8SArnaldo Carvalho de Melo
342878460e8SArnaldo Carvalho de Melo# Old clangs don't grok -Wno-unused-but-set-variable, remove it
343878460e8SArnaldo Carvalho de Meloifeq ($(CC_NO_CLANG), 0)
344878460e8SArnaldo Carvalho de Melo  CLANG_VERSION := $(shell $(CLANG) --version | head -1 | sed 's/.*clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g')
345878460e8SArnaldo Carvalho de Melo  ifeq ($(call version-lt3,$(CLANG_VERSION),13.0.0),1)
346878460e8SArnaldo Carvalho de Melo    bison_flags := $(subst -Wno-unused-but-set-variable,,$(bison_flags))
347878460e8SArnaldo Carvalho de Melo    flex_flags := $(subst -Wno-unused-but-set-variable,,$(flex_flags))
348878460e8SArnaldo Carvalho de Melo  endif
349878460e8SArnaldo Carvalho de Meloendif
350878460e8SArnaldo Carvalho de Melo
351ddc8e4c9SIan RogersBISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382)
352ddc8e4c9SIan Rogersifeq ($(BISON_GE_382),1)
353ddc8e4c9SIan Rogers  bison_flags += -Wno-switch-enum
3541f16fcadSIan Rogerselse
3551f16fcadSIan Rogers  bison_flags += -w
3561f16fcadSIan Rogersendif
35788cc47e2SArnaldo Carvalho de Melo
35888cc47e2SArnaldo Carvalho de MeloBISON_LT_381 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \< 381)
35988cc47e2SArnaldo Carvalho de Meloifeq ($(BISON_LT_381),1)
36088cc47e2SArnaldo Carvalho de Melo  bison_flags += -DYYNOMEM=YYABORT
36188cc47e2SArnaldo Carvalho de Meloendif
36288cc47e2SArnaldo Carvalho de Melo
3633d6dfae8SIan RogersCFLAGS_parse-events-flex.o  += $(flex_flags) -Wno-unused-label
364878460e8SArnaldo Carvalho de MeloCFLAGS_pmu-flex.o           += $(flex_flags)
365878460e8SArnaldo Carvalho de MeloCFLAGS_expr-flex.o          += $(flex_flags)
366878460e8SArnaldo Carvalho de MeloCFLAGS_bpf-filter-flex.o    += $(flex_flags)
367878460e8SArnaldo Carvalho de Melo
3681f16fcadSIan RogersCFLAGS_parse-events-bison.o += $(bison_flags)
3691f16fcadSIan RogersCFLAGS_pmu-bison.o          += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
3701f16fcadSIan RogersCFLAGS_expr-bison.o         += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
371990a71e9SNamhyung KimCFLAGS_bpf-filter-bison.o   += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
3729352aabaSJiri Olsa
3739352aabaSJiri Olsa$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
3749352aabaSJiri Olsa$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
37526226a97SJiri Olsa$(OUTPUT)util/expr.o: $(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-bison.c
376990a71e9SNamhyung Kim$(OUTPUT)util/bpf-filter.o: $(OUTPUT)util/bpf-filter-flex.c $(OUTPUT)util/bpf-filter-bison.c
3779352aabaSJiri Olsa
378915b0882SArnaldo Carvalho de MeloCFLAGS_bitmap.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
379552eb975SArnaldo Carvalho de MeloCFLAGS_find_bit.o      += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
3809352aabaSJiri OlsaCFLAGS_rbtree.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
3814ddd3274SArnaldo Carvalho de MeloCFLAGS_libstring.o     += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
3829352aabaSJiri OlsaCFLAGS_hweight.o       += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
383d25ed5d9SSoramichi AKIYAMACFLAGS_header.o        += -include $(OUTPUT)PERF-VERSION-FILE
384a29ee6aeSOliver UptonCFLAGS_arm-spe.o       += -I$(srctree)/tools/arch/arm64/include/ -I$(OUTPUT)arch/arm64/include/generated/
3859352aabaSJiri Olsa
3869c10548cSArnaldo Carvalho de Melo$(OUTPUT)util/argv_split.o: ../lib/argv_split.c FORCE
3879c10548cSArnaldo Carvalho de Melo	$(call rule_mkdir)
3889c10548cSArnaldo Carvalho de Melo	$(call if_changed_dep,cc_o_c)
3899c10548cSArnaldo Carvalho de Melo
390915b0882SArnaldo Carvalho de Melo$(OUTPUT)util/bitmap.o: ../lib/bitmap.c FORCE
391915b0882SArnaldo Carvalho de Melo	$(call rule_mkdir)
392915b0882SArnaldo Carvalho de Melo	$(call if_changed_dep,cc_o_c)
393915b0882SArnaldo Carvalho de Melo
3943052ba56SArnaldo Carvalho de Melo$(OUTPUT)util/ctype.o: ../lib/ctype.c FORCE
3953052ba56SArnaldo Carvalho de Melo	$(call rule_mkdir)
3963052ba56SArnaldo Carvalho de Melo	$(call if_changed_dep,cc_o_c)
3973052ba56SArnaldo Carvalho de Melo
398552eb975SArnaldo Carvalho de Melo$(OUTPUT)util/find_bit.o: ../lib/find_bit.c FORCE
3991999307bSJiri Olsa	$(call rule_mkdir)
4009352aabaSJiri Olsa	$(call if_changed_dep,cc_o_c)
4019352aabaSJiri Olsa
4023f735377SArnaldo Carvalho de Melo$(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE
4031999307bSJiri Olsa	$(call rule_mkdir)
4049352aabaSJiri Olsa	$(call if_changed_dep,cc_o_c)
4059352aabaSJiri Olsa
4064ddd3274SArnaldo Carvalho de Melo$(OUTPUT)util/libstring.o: ../lib/string.c FORCE
4074ddd3274SArnaldo Carvalho de Melo	$(call rule_mkdir)
4084ddd3274SArnaldo Carvalho de Melo	$(call if_changed_dep,cc_o_c)
4094ddd3274SArnaldo Carvalho de Melo
4100aefc359SArnaldo Carvalho de Melo$(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE
4111999307bSJiri Olsa	$(call rule_mkdir)
4129352aabaSJiri Olsa	$(call if_changed_dep,cc_o_c)
413d0761e37SArnaldo Carvalho de Melo
414d0761e37SArnaldo Carvalho de Melo$(OUTPUT)util/vsprintf.o: ../lib/vsprintf.c FORCE
415d0761e37SArnaldo Carvalho de Melo	$(call rule_mkdir)
416d0761e37SArnaldo Carvalho de Melo	$(call if_changed_dep,cc_o_c)
41792ec3cc9SIan Rogers
41892ec3cc9SIan Rogers$(OUTPUT)util/list_sort.o: ../lib/list_sort.c FORCE
41992ec3cc9SIan Rogers	$(call rule_mkdir)
42092ec3cc9SIan Rogers	$(call if_changed_dep,cc_o_c)
42161ff60aaSIan Rogers
42261ff60aaSIan Rogersifdef SHELLCHECK
42361ff60aaSIan Rogers  SHELL_TESTS := generate-cmdlist.sh
424ef238109SIan Rogers  SHELL_TEST_LOGS := $(SHELL_TESTS:%=%.shellcheck_log)
42561ff60aaSIan Rogerselse
42661ff60aaSIan Rogers  SHELL_TESTS :=
427ef238109SIan Rogers  SHELL_TEST_LOGS :=
42861ff60aaSIan Rogersendif
42961ff60aaSIan Rogers
43061ff60aaSIan Rogers$(OUTPUT)%.shellcheck_log: %
43161ff60aaSIan Rogers	$(call rule_mkdir)
432114339eeSCollin Funk	$(Q)$(call echo-cmd,test)$(SHELLCHECK) "$<" > $@ || (cat $@ && rm $@ && false)
43361ff60aaSIan Rogers
434ef238109SIan Rogersperf-util-y += $(SHELL_TEST_LOGS)
435168910d0SIan Rogers
436168910d0SIan RogersPY_TESTS := setup.py
437168910d0SIan Rogersifdef MYPY
438168910d0SIan Rogers  MYPY_TEST_LOGS := $(PY_TESTS:%=%.mypy_log)
439168910d0SIan Rogerselse
440168910d0SIan Rogers  MYPY_TEST_LOGS :=
441168910d0SIan Rogersendif
442168910d0SIan Rogers
443168910d0SIan Rogers$(OUTPUT)%.mypy_log: %
444168910d0SIan Rogers	$(call rule_mkdir)
445168910d0SIan Rogers	$(Q)$(call echo-cmd,test)mypy "$<" > $@ || (cat $@ && rm $@ && false)
446168910d0SIan Rogers
447168910d0SIan Rogersperf-util-y += $(MYPY_TEST_LOGS)
4488a54784eSIan Rogers
4498a54784eSIan Rogersifdef PYLINT
4508a54784eSIan Rogers  PYLINT_TEST_LOGS := $(PY_TESTS:%=%.pylint_log)
4518a54784eSIan Rogerselse
4528a54784eSIan Rogers  PYLINT_TEST_LOGS :=
4538a54784eSIan Rogersendif
4548a54784eSIan Rogers
4558a54784eSIan Rogers$(OUTPUT)%.pylint_log: %
4568a54784eSIan Rogers	$(call rule_mkdir)
4578a54784eSIan Rogers	$(Q)$(call echo-cmd,test)pylint "$<" > $@ || (cat $@ && rm $@ && false)
4588a54784eSIan Rogers
4598a54784eSIan Rogersperf-util-y += $(PYLINT_TEST_LOGS)
460