xref: /openbmc/linux/tools/Makefile (revision 4ab5a5d2)
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 '  cgroup                 - cgroup tools'
14	@echo '  cpupower               - a tool for all things x86 CPU power'
15	@echo '  debugging              - tools for debugging'
16	@echo '  firewire               - the userspace part of nosy, an IEEE-1394 traffic sniffer'
17	@echo '  freefall               - laptop accelerometer program for disk protection'
18	@echo '  gpio                   - GPIO tools'
19	@echo '  hv                     - tools used when in Hyper-V clients'
20	@echo '  iio                    - IIO tools'
21	@echo '  kvm_stat               - top-like utility for displaying kvm statistics'
22	@echo '  leds                   - LEDs  tools'
23	@echo '  liblockdep             - user-space wrapper for kernel locking-validator'
24	@echo '  bpf                    - misc BPF tools'
25	@echo '  pci                    - PCI tools'
26	@echo '  perf                   - Linux performance measurement and analysis tool'
27	@echo '  selftests              - various kernel selftests'
28	@echo '  spi                    - spi tools'
29	@echo '  objtool                - an ELF object analysis tool'
30	@echo '  tmon                   - thermal monitoring and tuning tool'
31	@echo '  turbostat              - Intel CPU idle stats and freq reporting tool'
32	@echo '  usb                    - USB testing tools'
33	@echo '  virtio                 - vhost test module'
34	@echo '  vm                     - misc vm tools'
35	@echo '  wmi			- WMI interface examples'
36	@echo '  x86_energy_perf_policy - Intel energy policy tool'
37	@echo ''
38	@echo 'You can do:'
39	@echo ' $$ make -C tools/ <tool>_install'
40	@echo ''
41	@echo '  from the kernel command line to build and install one of'
42	@echo '  the tools above'
43	@echo ''
44	@echo '  $$ make tools/all'
45	@echo ''
46	@echo '  builds all tools.'
47	@echo ''
48	@echo '  $$ make tools/install'
49	@echo ''
50	@echo '  installs all tools.'
51	@echo ''
52	@echo 'Cleaning targets:'
53	@echo ''
54	@echo '  all of the above with the "_clean" string appended cleans'
55	@echo '    the respective build directory.'
56	@echo '  clean: a summary clean target to clean _all_ folders'
57
58acpi: FORCE
59	$(call descend,power/$@)
60
61cpupower: FORCE
62	$(call descend,power/$@)
63
64cgroup firewire hv guest spi usb virtio vm bpf iio gpio objtool leds wmi pci debugging: FORCE
65	$(call descend,$@)
66
67liblockdep: FORCE
68	$(call descend,lib/lockdep)
69
70libapi: FORCE
71	$(call descend,lib/api)
72
73# The perf build does not follow the descend function setup,
74# invoking it via it's own make rule.
75PERF_O   = $(if $(O),$(O)/tools/perf,)
76
77perf: FORCE
78	$(Q)mkdir -p $(PERF_O) .
79	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir=
80
81selftests: FORCE
82	$(call descend,testing/$@)
83
84turbostat x86_energy_perf_policy: FORCE
85	$(call descend,power/x86/$@)
86
87tmon: FORCE
88	$(call descend,thermal/$@)
89
90freefall: FORCE
91	$(call descend,laptop/$@)
92
93kvm_stat: FORCE
94	$(call descend,kvm/$@)
95
96all: acpi cgroup cpupower gpio hv firewire liblockdep \
97		perf selftests spi turbostat usb \
98		virtio vm bpf x86_energy_perf_policy \
99		tmon freefall iio objtool kvm_stat wmi \
100		pci debugging
101
102acpi_install:
103	$(call descend,power/$(@:_install=),install)
104
105cpupower_install:
106	$(call descend,power/$(@:_install=),install)
107
108cgroup_install firewire_install gpio_install hv_install iio_install perf_install spi_install usb_install virtio_install vm_install bpf_install objtool_install wmi_install pci_install debugging_install:
109	$(call descend,$(@:_install=),install)
110
111liblockdep_install:
112	$(call descend,lib/lockdep,install)
113
114selftests_install:
115	$(call descend,testing/$(@:_install=),install)
116
117turbostat_install x86_energy_perf_policy_install:
118	$(call descend,power/x86/$(@:_install=),install)
119
120tmon_install:
121	$(call descend,thermal/$(@:_install=),install)
122
123freefall_install:
124	$(call descend,laptop/$(@:_install=),install)
125
126kvm_stat_install:
127	$(call descend,kvm/$(@:_install=),install)
128
129install: acpi_install cgroup_install cpupower_install gpio_install \
130		hv_install firewire_install iio_install liblockdep_install \
131		perf_install selftests_install turbostat_install usb_install \
132		virtio_install vm_install bpf_install x86_energy_perf_policy_install \
133		tmon_install freefall_install objtool_install kvm_stat_install \
134		wmi_install pci_install debugging_install
135
136acpi_clean:
137	$(call descend,power/acpi,clean)
138
139cpupower_clean:
140	$(call descend,power/cpupower,clean)
141
142cgroup_clean hv_clean firewire_clean spi_clean usb_clean virtio_clean vm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean debugging_clean:
143	$(call descend,$(@:_clean=),clean)
144
145liblockdep_clean:
146	$(call descend,lib/lockdep,clean)
147
148libapi_clean:
149	$(call descend,lib/api,clean)
150
151libbpf_clean:
152	$(call descend,lib/bpf,clean)
153
154libsubcmd_clean:
155	$(call descend,lib/subcmd,clean)
156
157perf_clean:
158	$(Q)mkdir -p $(PERF_O) .
159	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir= clean
160
161selftests_clean:
162	$(call descend,testing/$(@:_clean=),clean)
163
164turbostat_clean x86_energy_perf_policy_clean:
165	$(call descend,power/x86/$(@:_clean=),clean)
166
167tmon_clean:
168	$(call descend,thermal/tmon,clean)
169
170freefall_clean:
171	$(call descend,laptop/freefall,clean)
172
173build_clean:
174	$(call descend,build,clean)
175
176clean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean \
177		perf_clean selftests_clean turbostat_clean spi_clean usb_clean virtio_clean \
178		vm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
179		freefall_clean build_clean libbpf_clean libsubcmd_clean liblockdep_clean \
180		gpio_clean objtool_clean leds_clean wmi_clean pci_clean debugging_clean
181
182.PHONY: FORCE
183