xref: /openbmc/linux/tools/Makefile (revision 8a5aaf97)
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 '  firewire               - the userspace part of nosy, an IEEE-1394 traffic sniffer'
16	@echo '  firmware               - Firmware tools'
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 firmware: 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 pci
100
101acpi_install:
102	$(call descend,power/$(@:_install=),install)
103
104cpupower_install:
105	$(call descend,power/$(@:_install=),install)
106
107cgroup_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:
108	$(call descend,$(@:_install=),install)
109
110liblockdep_install:
111	$(call descend,lib/lockdep,install)
112
113selftests_install:
114	$(call descend,testing/$(@:_install=),install)
115
116turbostat_install x86_energy_perf_policy_install:
117	$(call descend,power/x86/$(@:_install=),install)
118
119tmon_install:
120	$(call descend,thermal/$(@:_install=),install)
121
122freefall_install:
123	$(call descend,laptop/$(@:_install=),install)
124
125kvm_stat_install:
126	$(call descend,kvm/$(@:_install=),install)
127
128install: acpi_install cgroup_install cpupower_install gpio_install \
129		hv_install firewire_install iio_install liblockdep_install \
130		perf_install selftests_install turbostat_install usb_install \
131		virtio_install vm_install bpf_install x86_energy_perf_policy_install \
132		tmon_install freefall_install objtool_install kvm_stat_install \
133		wmi_install pci_install
134
135acpi_clean:
136	$(call descend,power/acpi,clean)
137
138cpupower_clean:
139	$(call descend,power/cpupower,clean)
140
141cgroup_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 firmware_clean:
142	$(call descend,$(@:_clean=),clean)
143
144liblockdep_clean:
145	$(call descend,lib/lockdep,clean)
146
147libapi_clean:
148	$(call descend,lib/api,clean)
149
150libbpf_clean:
151	$(call descend,lib/bpf,clean)
152
153libsubcmd_clean:
154	$(call descend,lib/subcmd,clean)
155
156perf_clean:
157	$(Q)mkdir -p $(PERF_O) .
158	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir= clean
159
160selftests_clean:
161	$(call descend,testing/$(@:_clean=),clean)
162
163turbostat_clean x86_energy_perf_policy_clean:
164	$(call descend,power/x86/$(@:_clean=),clean)
165
166tmon_clean:
167	$(call descend,thermal/tmon,clean)
168
169freefall_clean:
170	$(call descend,laptop/freefall,clean)
171
172build_clean:
173	$(call descend,build,clean)
174
175clean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean \
176		perf_clean selftests_clean turbostat_clean spi_clean usb_clean virtio_clean \
177		vm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
178		freefall_clean build_clean libbpf_clean libsubcmd_clean liblockdep_clean \
179		gpio_clean objtool_clean leds_clean wmi_clean pci_clean firmware_clean
180
181.PHONY: FORCE
182