18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci# Some of the tools (perf) use same make variables
38c2ecf20Sopenharmony_ci# as in kernel build.
48c2ecf20Sopenharmony_ciexport srctree=
58c2ecf20Sopenharmony_ciexport objtree=
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciinclude scripts/Makefile.include
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cihelp:
108c2ecf20Sopenharmony_ci	@echo 'Possible targets:'
118c2ecf20Sopenharmony_ci	@echo ''
128c2ecf20Sopenharmony_ci	@echo '  acpi                   - ACPI tools'
138c2ecf20Sopenharmony_ci	@echo '  bpf                    - misc BPF tools'
148c2ecf20Sopenharmony_ci	@echo '  cgroup                 - cgroup tools'
158c2ecf20Sopenharmony_ci	@echo '  cpupower               - a tool for all things x86 CPU power'
168c2ecf20Sopenharmony_ci	@echo '  debugging              - tools for debugging'
178c2ecf20Sopenharmony_ci	@echo '  firewire               - the userspace part of nosy, an IEEE-1394 traffic sniffer'
188c2ecf20Sopenharmony_ci	@echo '  firmware               - Firmware tools'
198c2ecf20Sopenharmony_ci	@echo '  freefall               - laptop accelerometer program for disk protection'
208c2ecf20Sopenharmony_ci	@echo '  gpio                   - GPIO tools'
218c2ecf20Sopenharmony_ci	@echo '  hv                     - tools used when in Hyper-V clients'
228c2ecf20Sopenharmony_ci	@echo '  iio                    - IIO tools'
238c2ecf20Sopenharmony_ci	@echo '  intel-speed-select     - Intel Speed Select tool'
248c2ecf20Sopenharmony_ci	@echo '  kvm_stat               - top-like utility for displaying kvm statistics'
258c2ecf20Sopenharmony_ci	@echo '  leds                   - LEDs  tools'
268c2ecf20Sopenharmony_ci	@echo '  liblockdep             - user-space wrapper for kernel locking-validator'
278c2ecf20Sopenharmony_ci	@echo '  objtool                - an ELF object analysis tool'
288c2ecf20Sopenharmony_ci	@echo '  pci                    - PCI tools'
298c2ecf20Sopenharmony_ci	@echo '  perf                   - Linux performance measurement and analysis tool'
308c2ecf20Sopenharmony_ci	@echo '  selftests              - various kernel selftests'
318c2ecf20Sopenharmony_ci	@echo '  bootconfig             - boot config tool'
328c2ecf20Sopenharmony_ci	@echo '  spi                    - spi tools'
338c2ecf20Sopenharmony_ci	@echo '  tmon                   - thermal monitoring and tuning tool'
348c2ecf20Sopenharmony_ci	@echo '  turbostat              - Intel CPU idle stats and freq reporting tool'
358c2ecf20Sopenharmony_ci	@echo '  usb                    - USB testing tools'
368c2ecf20Sopenharmony_ci	@echo '  virtio                 - vhost test module'
378c2ecf20Sopenharmony_ci	@echo '  vm                     - misc vm tools'
388c2ecf20Sopenharmony_ci	@echo '  wmi			- WMI interface examples'
398c2ecf20Sopenharmony_ci	@echo '  x86_energy_perf_policy - Intel energy policy tool'
408c2ecf20Sopenharmony_ci	@echo ''
418c2ecf20Sopenharmony_ci	@echo 'You can do:'
428c2ecf20Sopenharmony_ci	@echo ' $$ make -C tools/ <tool>_install'
438c2ecf20Sopenharmony_ci	@echo ''
448c2ecf20Sopenharmony_ci	@echo '  from the kernel command line to build and install one of'
458c2ecf20Sopenharmony_ci	@echo '  the tools above'
468c2ecf20Sopenharmony_ci	@echo ''
478c2ecf20Sopenharmony_ci	@echo '  $$ make tools/all'
488c2ecf20Sopenharmony_ci	@echo ''
498c2ecf20Sopenharmony_ci	@echo '  builds all tools.'
508c2ecf20Sopenharmony_ci	@echo ''
518c2ecf20Sopenharmony_ci	@echo '  $$ make tools/install'
528c2ecf20Sopenharmony_ci	@echo ''
538c2ecf20Sopenharmony_ci	@echo '  installs all tools.'
548c2ecf20Sopenharmony_ci	@echo ''
558c2ecf20Sopenharmony_ci	@echo 'Cleaning targets:'
568c2ecf20Sopenharmony_ci	@echo ''
578c2ecf20Sopenharmony_ci	@echo '  all of the above with the "_clean" string appended cleans'
588c2ecf20Sopenharmony_ci	@echo '    the respective build directory.'
598c2ecf20Sopenharmony_ci	@echo '  clean: a summary clean target to clean _all_ folders'
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciacpi: FORCE
628c2ecf20Sopenharmony_ci	$(call descend,power/$@)
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cicpupower: FORCE
658c2ecf20Sopenharmony_ci	$(call descend,power/$@)
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_cicgroup firewire hv guest bootconfig spi usb virtio vm bpf iio gpio objtool leds wmi pci firmware debugging: FORCE
688c2ecf20Sopenharmony_ci	$(call descend,$@)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_cibpf/%: FORCE
718c2ecf20Sopenharmony_ci	$(call descend,$@)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ciliblockdep: FORCE
748c2ecf20Sopenharmony_ci	$(call descend,lib/lockdep)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_cilibapi: FORCE
778c2ecf20Sopenharmony_ci	$(call descend,lib/api)
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci# The perf build does not follow the descend function setup,
808c2ecf20Sopenharmony_ci# invoking it via it's own make rule.
818c2ecf20Sopenharmony_ciPERF_O   = $(if $(O),$(O)/tools/perf,)
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ciperf: FORCE
848c2ecf20Sopenharmony_ci	$(Q)mkdir -p $(PERF_O) .
858c2ecf20Sopenharmony_ci	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir=
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ciselftests: FORCE
888c2ecf20Sopenharmony_ci	$(call descend,testing/$@)
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_citurbostat x86_energy_perf_policy intel-speed-select: FORCE
918c2ecf20Sopenharmony_ci	$(call descend,power/x86/$@)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_citmon: FORCE
948c2ecf20Sopenharmony_ci	$(call descend,thermal/$@)
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_cifreefall: FORCE
978c2ecf20Sopenharmony_ci	$(call descend,laptop/$@)
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_cikvm_stat: FORCE
1008c2ecf20Sopenharmony_ci	$(call descend,kvm/$@)
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ciall: acpi cgroup cpupower gpio hv firewire liblockdep \
1038c2ecf20Sopenharmony_ci		perf selftests bootconfig spi turbostat usb \
1048c2ecf20Sopenharmony_ci		virtio vm bpf x86_energy_perf_policy \
1058c2ecf20Sopenharmony_ci		tmon freefall iio objtool kvm_stat wmi \
1068c2ecf20Sopenharmony_ci		pci debugging
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ciacpi_install:
1098c2ecf20Sopenharmony_ci	$(call descend,power/$(@:_install=),install)
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_cicpupower_install:
1128c2ecf20Sopenharmony_ci	$(call descend,power/$(@:_install=),install)
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_cicgroup_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:
1158c2ecf20Sopenharmony_ci	$(call descend,$(@:_install=),install)
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ciliblockdep_install:
1188c2ecf20Sopenharmony_ci	$(call descend,lib/lockdep,install)
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ciselftests_install:
1218c2ecf20Sopenharmony_ci	$(call descend,testing/$(@:_install=),install)
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_citurbostat_install x86_energy_perf_policy_install intel-speed-select_install:
1248c2ecf20Sopenharmony_ci	$(call descend,power/x86/$(@:_install=),install)
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_citmon_install:
1278c2ecf20Sopenharmony_ci	$(call descend,thermal/$(@:_install=),install)
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_cifreefall_install:
1308c2ecf20Sopenharmony_ci	$(call descend,laptop/$(@:_install=),install)
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_cikvm_stat_install:
1338c2ecf20Sopenharmony_ci	$(call descend,kvm/$(@:_install=),install)
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ciinstall: acpi_install cgroup_install cpupower_install gpio_install \
1368c2ecf20Sopenharmony_ci		hv_install firewire_install iio_install liblockdep_install \
1378c2ecf20Sopenharmony_ci		perf_install selftests_install turbostat_install usb_install \
1388c2ecf20Sopenharmony_ci		virtio_install vm_install bpf_install x86_energy_perf_policy_install \
1398c2ecf20Sopenharmony_ci		tmon_install freefall_install objtool_install kvm_stat_install \
1408c2ecf20Sopenharmony_ci		wmi_install pci_install debugging_install intel-speed-select_install
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ciacpi_clean:
1438c2ecf20Sopenharmony_ci	$(call descend,power/acpi,clean)
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_cicpupower_clean:
1468c2ecf20Sopenharmony_ci	$(call descend,power/cpupower,clean)
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_cicgroup_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:
1498c2ecf20Sopenharmony_ci	$(call descend,$(@:_clean=),clean)
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ciliblockdep_clean:
1528c2ecf20Sopenharmony_ci	$(call descend,lib/lockdep,clean)
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_cilibapi_clean:
1558c2ecf20Sopenharmony_ci	$(call descend,lib/api,clean)
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_cilibbpf_clean:
1588c2ecf20Sopenharmony_ci	$(call descend,lib/bpf,clean)
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_cilibsubcmd_clean:
1618c2ecf20Sopenharmony_ci	$(call descend,lib/subcmd,clean)
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ciperf_clean:
1648c2ecf20Sopenharmony_ci	$(Q)mkdir -p $(PERF_O) .
1658c2ecf20Sopenharmony_ci	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir= clean
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ciselftests_clean:
1688c2ecf20Sopenharmony_ci	$(call descend,testing/$(@:_clean=),clean)
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_citurbostat_clean x86_energy_perf_policy_clean intel-speed-select_clean:
1718c2ecf20Sopenharmony_ci	$(call descend,power/x86/$(@:_clean=),clean)
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_citmon_clean:
1748c2ecf20Sopenharmony_ci	$(call descend,thermal/tmon,clean)
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_cifreefall_clean:
1778c2ecf20Sopenharmony_ci	$(call descend,laptop/freefall,clean)
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_cibuild_clean:
1808c2ecf20Sopenharmony_ci	$(call descend,build,clean)
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ciclean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean \
1838c2ecf20Sopenharmony_ci		perf_clean selftests_clean turbostat_clean bootconfig_clean spi_clean usb_clean virtio_clean \
1848c2ecf20Sopenharmony_ci		vm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
1858c2ecf20Sopenharmony_ci		freefall_clean build_clean libbpf_clean libsubcmd_clean liblockdep_clean \
1868c2ecf20Sopenharmony_ci		gpio_clean objtool_clean leds_clean wmi_clean pci_clean firmware_clean debugging_clean \
1878c2ecf20Sopenharmony_ci		intel-speed-select_clean
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci.PHONY: FORCE
190