xref: /linux/tools/Makefile (revision a7405aa92feec2598cedc1b6c651beb1848240fe)
1# SPDX-License-Identifier: GPL-2.0
2# Some of the tools (perf) use same make variables
3# as in kernel build.
4export srctree=
5export objtree=
6
7include scripts/Makefile.include
8
9help:
10	@echo 'Possible targets:'
11	@echo ''
12	@echo '  acpi                   - ACPI tools'
13	@echo '  bpf                    - misc BPF tools'
14	@echo '  counter                - counter tools'
15	@echo '  cpupower               - a tool for all things x86 CPU power'
16	@echo '  debugging              - tools for debugging'
17	@echo '  dma                    - tools for DMA mapping'
18	@echo '  firewire               - the userspace part of nosy, an IEEE-1394 traffic sniffer'
19	@echo '  firmware               - Firmware tools'
20	@echo '  freefall               - laptop accelerometer program for disk protection'
21	@echo '  gpio                   - GPIO tools'
22	@echo '  hv                     - tools used when in Hyper-V clients'
23	@echo '  iio                    - IIO tools'
24	@echo '  intel-speed-select     - Intel Speed Select tool'
25	@echo '  kvm_stat               - top-like utility for displaying kvm statistics'
26	@echo '  leds                   - LEDs  tools'
27	@echo '  nolibc                 - nolibc headers testing and installation'
28	@echo '  objtool                - an ELF object analysis tool'
29	@echo '  perf                   - Linux performance measurement and analysis tool'
30	@echo '  selftests              - various kernel selftests'
31	@echo '  sched_ext              - sched_ext example schedulers'
32	@echo '  bootconfig             - boot config tool'
33	@echo '  spi                    - spi tools'
34	@echo '  tmon                   - thermal monitoring and tuning tool'
35	@echo '  thermometer            - temperature capture tool'
36	@echo '  thermal-engine         - thermal monitoring tool'
37	@echo '  thermal                - thermal library'
38	@echo '  tracing                - misc tracing tools'
39	@echo '  turbostat              - Intel CPU idle stats and freq reporting tool'
40	@echo '  usb                    - USB testing tools'
41	@echo '  virtio                 - vhost test module'
42	@echo '  mm                     - misc mm tools'
43	@echo '  wmi			- WMI interface examples'
44	@echo '  x86_energy_perf_policy - Intel energy policy tool'
45	@echo '  ynl			- ynl headers, library, and python tool'
46	@echo ''
47	@echo 'You can do:'
48	@echo ' $$ make -C tools/ <tool>_install'
49	@echo ''
50	@echo '  from the kernel command line to build and install one of'
51	@echo '  the tools above'
52	@echo ''
53	@echo '  $$ make tools/all'
54	@echo ''
55	@echo '  builds all tools.'
56	@echo ''
57	@echo '  $$ make tools/install'
58	@echo ''
59	@echo '  installs all tools.'
60	@echo ''
61	@echo 'Cleaning targets:'
62	@echo ''
63	@echo '  all of the above with the "_clean" string appended cleans'
64	@echo '    the respective build directory.'
65	@echo '  clean: a summary clean target to clean _all_ folders'
66
67acpi: FORCE
68	$(call descend,power/$@)
69
70cpupower: FORCE
71	$(call descend,power/$@)
72
73counter dma firewire hv guest bootconfig spi usb virtio mm bpf iio gpio objtool leds wmi firmware debugging tracing: FORCE
74	$(call descend,$@)
75
76bpf/%: FORCE
77	$(call descend,$@)
78
79libapi: FORCE
80	$(call descend,lib/api)
81
82nolibc: FORCE
83	$(call descend,include/nolibc)
84
85nolibc_%: FORCE
86	$(call descend,include/nolibc,$(patsubst nolibc_%,%,$@))
87
88# The perf build does not follow the descend function setup,
89# invoking it via it's own make rule.
90PERF_O   = $(if $(O),$(O)/tools/perf,)
91
92perf: FORCE
93	$(Q)mkdir -p $(PERF_O) .
94	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir=
95
96sched_ext: FORCE
97	$(call descend,sched_ext)
98
99selftests: FORCE
100	$(call descend,testing/$@)
101
102thermal: FORCE
103	$(call descend,lib/$@)
104
105turbostat x86_energy_perf_policy intel-speed-select: FORCE
106	$(call descend,power/x86/$@)
107
108tmon: FORCE
109	$(call descend,thermal/$@)
110
111thermometer: FORCE
112	$(call descend,thermal/$@)
113
114thermal-engine: FORCE thermal
115	$(call descend,thermal/$@)
116
117freefall: FORCE
118	$(call descend,laptop/$@)
119
120kvm_stat: FORCE
121	$(call descend,kvm/$@)
122
123ynl: FORCE
124	$(call descend,net/ynl)
125
126all: acpi counter cpupower dma gpio hv firewire \
127		perf selftests bootconfig spi turbostat usb \
128		virtio mm bpf x86_energy_perf_policy \
129		tmon freefall iio objtool kvm_stat wmi \
130		debugging tracing thermal thermometer thermal-engine ynl
131
132acpi_install:
133	$(call descend,power/$(@:_install=),install)
134
135cpupower_install:
136	$(call descend,power/$(@:_install=),install)
137
138counter_install dma_install firewire_install gpio_install hv_install iio_install perf_install bootconfig_install spi_install usb_install virtio_install mm_install bpf_install objtool_install wmi_install debugging_install tracing_install:
139	$(call descend,$(@:_install=),install)
140
141selftests_install:
142	$(call descend,testing/$(@:_install=),install)
143
144thermal_install:
145	$(call descend,lib/$(@:_install=),install)
146
147turbostat_install x86_energy_perf_policy_install intel-speed-select_install:
148	$(call descend,power/x86/$(@:_install=),install)
149
150tmon_install:
151	$(call descend,thermal/$(@:_install=),install)
152
153thermometer_install:
154	$(call descend,thermal/$(@:_install=),install)
155
156thermal-engine_install:
157	$(call descend,thermal/$(@:_install=),install)
158
159freefall_install:
160	$(call descend,laptop/$(@:_install=),install)
161
162kvm_stat_install:
163	$(call descend,kvm/$(@:_install=),install)
164
165ynl_install:
166	$(call descend,net/$(@:_install=),install)
167
168install: acpi_install counter_install cpupower_install dma_install gpio_install \
169		hv_install firewire_install iio_install \
170		perf_install selftests_install turbostat_install usb_install \
171		virtio_install mm_install bpf_install x86_energy_perf_policy_install \
172		tmon_install freefall_install objtool_install kvm_stat_install \
173		wmi_install debugging_install intel-speed-select_install \
174		tracing_install thermometer_install thermal-engine_install ynl_install
175
176acpi_clean:
177	$(call descend,power/acpi,clean)
178
179cpupower_clean:
180	$(call descend,power/cpupower,clean)
181
182counter_clean dma_clean hv_clean firewire_clean bootconfig_clean spi_clean usb_clean virtio_clean mm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean firmware_clean debugging_clean tracing_clean:
183	$(call descend,$(@:_clean=),clean)
184
185libapi_clean:
186	$(call descend,lib/api,clean)
187
188libbpf_clean:
189	$(call descend,lib/bpf,clean)
190
191libsubcmd_clean:
192	$(call descend,lib/subcmd,clean)
193
194perf_clean:
195	$(Q)mkdir -p $(PERF_O) .
196	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir= clean
197
198sched_ext_clean:
199	$(call descend,sched_ext,clean)
200
201selftests_clean:
202	$(call descend,testing/$(@:_clean=),clean)
203
204thermal_clean:
205	$(call descend,lib/thermal,clean)
206
207turbostat_clean x86_energy_perf_policy_clean intel-speed-select_clean:
208	$(call descend,power/x86/$(@:_clean=),clean)
209
210thermometer_clean:
211	$(call descend,thermal/thermometer,clean)
212
213thermal-engine_clean:
214	$(call descend,thermal/thermal-engine,clean)
215
216tmon_clean:
217	$(call descend,thermal/tmon,clean)
218
219freefall_clean:
220	$(call descend,laptop/freefall,clean)
221
222build_clean:
223	$(call descend,build,clean)
224
225ynl_clean:
226	$(call descend,net/$(@:_clean=),clean)
227
228clean: acpi_clean counter_clean cpupower_clean dma_clean hv_clean firewire_clean \
229		perf_clean selftests_clean turbostat_clean bootconfig_clean spi_clean usb_clean virtio_clean \
230		mm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
231		freefall_clean build_clean libbpf_clean libsubcmd_clean \
232		gpio_clean objtool_clean leds_clean wmi_clean firmware_clean debugging_clean \
233		intel-speed-select_clean tracing_clean thermal_clean thermometer_clean thermal-engine_clean \
234		sched_ext_clean ynl_clean
235
236.PHONY: FORCE
237