xref: /openbmc/linux/tools/Makefile (revision 110acbc6a4518145db3a1a9c0686d730bb258bf1)
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 '  cgroup                 - cgroup tools'
15	@echo '  counter                - counter tools'
16	@echo '  cpupower               - a tool for all things x86 CPU power'
17	@echo '  debugging              - tools for debugging'
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 '  objtool                - an ELF object analysis tool'
28	@echo '  pci                    - PCI tools'
29	@echo '  perf                   - Linux performance measurement and analysis tool'
30	@echo '  selftests              - various kernel selftests'
31	@echo '  bootconfig             - boot config tool'
32	@echo '  spi                    - spi tools'
33	@echo '  tmon                   - thermal monitoring and tuning tool'
34	@echo '  thermometer            - temperature capture tool'
35	@echo '  thermal                - thermal library'
36	@echo '  tracing                - misc tracing tools'
37	@echo '  turbostat              - Intel CPU idle stats and freq reporting tool'
38	@echo '  usb                    - USB testing tools'
39	@echo '  virtio                 - vhost test module'
40	@echo '  vm                     - misc vm tools'
41	@echo '  wmi			- WMI interface examples'
42	@echo '  x86_energy_perf_policy - Intel energy policy tool'
43	@echo ''
44	@echo 'You can do:'
45	@echo ' $$ make -C tools/ <tool>_install'
46	@echo ''
47	@echo '  from the kernel command line to build and install one of'
48	@echo '  the tools above'
49	@echo ''
50	@echo '  $$ make tools/all'
51	@echo ''
52	@echo '  builds all tools.'
53	@echo ''
54	@echo '  $$ make tools/install'
55	@echo ''
56	@echo '  installs all tools.'
57	@echo ''
58	@echo 'Cleaning targets:'
59	@echo ''
60	@echo '  all of the above with the "_clean" string appended cleans'
61	@echo '    the respective build directory.'
62	@echo '  clean: a summary clean target to clean _all_ folders'
63
64acpi: FORCE
65	$(call descend,power/$@)
66
67cpupower: FORCE
68	$(call descend,power/$@)
69
70cgroup counter firewire hv guest bootconfig spi usb virtio vm bpf iio gpio objtool leds wmi pci firmware debugging tracing: FORCE
71	$(call descend,$@)
72
73bpf/%: FORCE
74	$(call descend,$@)
75
76libapi: FORCE
77	$(call descend,lib/api)
78
79# The perf build does not follow the descend function setup,
80# invoking it via it's own make rule.
81PERF_O   = $(if $(O),$(O)/tools/perf,)
82
83perf: FORCE
84	$(Q)mkdir -p $(PERF_O) .
85	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir=
86
87selftests: FORCE
88	$(call descend,testing/$@)
89
90thermal: FORCE
91	$(call descend,lib/$@)
92
93turbostat x86_energy_perf_policy intel-speed-select: FORCE
94	$(call descend,power/x86/$@)
95
96tmon: FORCE
97	$(call descend,thermal/$@)
98
99thermometer: FORCE
100	$(call descend,thermal/$@)
101
102freefall: FORCE
103	$(call descend,laptop/$@)
104
105kvm_stat: FORCE
106	$(call descend,kvm/$@)
107
108all: acpi cgroup counter cpupower gpio hv firewire \
109		perf selftests bootconfig spi turbostat usb \
110		virtio vm bpf x86_energy_perf_policy \
111		tmon freefall iio objtool kvm_stat wmi \
112		pci debugging tracing thermal thermometer
113
114acpi_install:
115	$(call descend,power/$(@:_install=),install)
116
117cpupower_install:
118	$(call descend,power/$(@:_install=),install)
119
120cgroup_install counter_install firewire_install gpio_install hv_install iio_install perf_install bootconfig_install spi_install usb_install virtio_install vm_install bpf_install objtool_install wmi_install pci_install debugging_install tracing_install:
121	$(call descend,$(@:_install=),install)
122
123selftests_install:
124	$(call descend,testing/$(@:_install=),install)
125
126thermal_install:
127	$(call descend,lib/$(@:_install=),install)
128
129turbostat_install x86_energy_perf_policy_install intel-speed-select_install:
130	$(call descend,power/x86/$(@:_install=),install)
131
132tmon_install:
133	$(call descend,thermal/$(@:_install=),install)
134
135thermometer_install:
136	$(call descend,thermal/$(@:_install=),install)
137
138freefall_install:
139	$(call descend,laptop/$(@:_install=),install)
140
141kvm_stat_install:
142	$(call descend,kvm/$(@:_install=),install)
143
144install: acpi_install cgroup_install counter_install cpupower_install gpio_install \
145		hv_install firewire_install iio_install \
146		perf_install selftests_install turbostat_install usb_install \
147		virtio_install vm_install bpf_install x86_energy_perf_policy_install \
148		tmon_install freefall_install objtool_install kvm_stat_install \
149		wmi_install pci_install debugging_install intel-speed-select_install \
150		tracing_install thermometer_install
151
152acpi_clean:
153	$(call descend,power/acpi,clean)
154
155cpupower_clean:
156	$(call descend,power/cpupower,clean)
157
158cgroup_clean counter_clean hv_clean firewire_clean bootconfig_clean spi_clean usb_clean virtio_clean vm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean firmware_clean debugging_clean tracing_clean:
159	$(call descend,$(@:_clean=),clean)
160
161libapi_clean:
162	$(call descend,lib/api,clean)
163
164libbpf_clean:
165	$(call descend,lib/bpf,clean)
166
167libsubcmd_clean:
168	$(call descend,lib/subcmd,clean)
169
170perf_clean:
171	$(Q)mkdir -p $(PERF_O) .
172	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir= clean
173
174selftests_clean:
175	$(call descend,testing/$(@:_clean=),clean)
176
177thermal_clean:
178	$(call descend,lib/thermal,clean)
179
180turbostat_clean x86_energy_perf_policy_clean intel-speed-select_clean:
181	$(call descend,power/x86/$(@:_clean=),clean)
182
183thermometer_clean:
184	$(call descend,thermal/thermometer,clean)
185
186tmon_clean:
187	$(call descend,thermal/tmon,clean)
188
189freefall_clean:
190	$(call descend,laptop/freefall,clean)
191
192build_clean:
193	$(call descend,build,clean)
194
195clean: acpi_clean cgroup_clean counter_clean cpupower_clean hv_clean firewire_clean \
196		perf_clean selftests_clean turbostat_clean bootconfig_clean spi_clean usb_clean virtio_clean \
197		vm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
198		freefall_clean build_clean libbpf_clean libsubcmd_clean \
199		gpio_clean objtool_clean leds_clean wmi_clean pci_clean firmware_clean debugging_clean \
200		intel-speed-select_clean tracing_clean thermal_clean thermometer_clean
201
202.PHONY: FORCE
203