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