162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci# Some of the tools (perf) use same make variables
362306a36Sopenharmony_ci# as in kernel build.
462306a36Sopenharmony_ciexport srctree=
562306a36Sopenharmony_ciexport objtree=
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciinclude scripts/Makefile.include
862306a36Sopenharmony_ci
962306a36Sopenharmony_cihelp:
1062306a36Sopenharmony_ci	@echo 'Possible targets:'
1162306a36Sopenharmony_ci	@echo ''
1262306a36Sopenharmony_ci	@echo '  acpi                   - ACPI tools'
1362306a36Sopenharmony_ci	@echo '  bpf                    - misc BPF tools'
1462306a36Sopenharmony_ci	@echo '  cgroup                 - cgroup tools'
1562306a36Sopenharmony_ci	@echo '  counter                - counter tools'
1662306a36Sopenharmony_ci	@echo '  cpupower               - a tool for all things x86 CPU power'
1762306a36Sopenharmony_ci	@echo '  debugging              - tools for debugging'
1862306a36Sopenharmony_ci	@echo '  firewire               - the userspace part of nosy, an IEEE-1394 traffic sniffer'
1962306a36Sopenharmony_ci	@echo '  firmware               - Firmware tools'
2062306a36Sopenharmony_ci	@echo '  freefall               - laptop accelerometer program for disk protection'
2162306a36Sopenharmony_ci	@echo '  gpio                   - GPIO tools'
2262306a36Sopenharmony_ci	@echo '  hv                     - tools used when in Hyper-V clients'
2362306a36Sopenharmony_ci	@echo '  iio                    - IIO tools'
2462306a36Sopenharmony_ci	@echo '  intel-speed-select     - Intel Speed Select tool'
2562306a36Sopenharmony_ci	@echo '  kvm_stat               - top-like utility for displaying kvm statistics'
2662306a36Sopenharmony_ci	@echo '  leds                   - LEDs  tools'
2762306a36Sopenharmony_ci	@echo '  nolibc                 - nolibc headers testing and installation'
2862306a36Sopenharmony_ci	@echo '  objtool                - an ELF object analysis tool'
2962306a36Sopenharmony_ci	@echo '  pci                    - PCI tools'
3062306a36Sopenharmony_ci	@echo '  perf                   - Linux performance measurement and analysis tool'
3162306a36Sopenharmony_ci	@echo '  selftests              - various kernel selftests'
3262306a36Sopenharmony_ci	@echo '  bootconfig             - boot config tool'
3362306a36Sopenharmony_ci	@echo '  spi                    - spi tools'
3462306a36Sopenharmony_ci	@echo '  tmon                   - thermal monitoring and tuning tool'
3562306a36Sopenharmony_ci	@echo '  thermometer            - temperature capture tool'
3662306a36Sopenharmony_ci	@echo '  thermal-engine         - thermal monitoring tool'
3762306a36Sopenharmony_ci	@echo '  thermal                - thermal library'
3862306a36Sopenharmony_ci	@echo '  tracing                - misc tracing tools'
3962306a36Sopenharmony_ci	@echo '  turbostat              - Intel CPU idle stats and freq reporting tool'
4062306a36Sopenharmony_ci	@echo '  usb                    - USB testing tools'
4162306a36Sopenharmony_ci	@echo '  virtio                 - vhost test module'
4262306a36Sopenharmony_ci	@echo '  mm                     - misc mm tools'
4362306a36Sopenharmony_ci	@echo '  wmi			- WMI interface examples'
4462306a36Sopenharmony_ci	@echo '  x86_energy_perf_policy - Intel energy policy tool'
4562306a36Sopenharmony_ci	@echo ''
4662306a36Sopenharmony_ci	@echo 'You can do:'
4762306a36Sopenharmony_ci	@echo ' $$ make -C tools/ <tool>_install'
4862306a36Sopenharmony_ci	@echo ''
4962306a36Sopenharmony_ci	@echo '  from the kernel command line to build and install one of'
5062306a36Sopenharmony_ci	@echo '  the tools above'
5162306a36Sopenharmony_ci	@echo ''
5262306a36Sopenharmony_ci	@echo '  $$ make tools/all'
5362306a36Sopenharmony_ci	@echo ''
5462306a36Sopenharmony_ci	@echo '  builds all tools.'
5562306a36Sopenharmony_ci	@echo ''
5662306a36Sopenharmony_ci	@echo '  $$ make tools/install'
5762306a36Sopenharmony_ci	@echo ''
5862306a36Sopenharmony_ci	@echo '  installs all tools.'
5962306a36Sopenharmony_ci	@echo ''
6062306a36Sopenharmony_ci	@echo 'Cleaning targets:'
6162306a36Sopenharmony_ci	@echo ''
6262306a36Sopenharmony_ci	@echo '  all of the above with the "_clean" string appended cleans'
6362306a36Sopenharmony_ci	@echo '    the respective build directory.'
6462306a36Sopenharmony_ci	@echo '  clean: a summary clean target to clean _all_ folders'
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ciacpi: FORCE
6762306a36Sopenharmony_ci	$(call descend,power/$@)
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_cicpupower: FORCE
7062306a36Sopenharmony_ci	$(call descend,power/$@)
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_cicgroup counter firewire hv guest bootconfig spi usb virtio mm bpf iio gpio objtool leds wmi pci firmware debugging tracing: FORCE
7362306a36Sopenharmony_ci	$(call descend,$@)
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_cibpf/%: FORCE
7662306a36Sopenharmony_ci	$(call descend,$@)
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_cilibapi: FORCE
7962306a36Sopenharmony_ci	$(call descend,lib/api)
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_cinolibc: FORCE
8262306a36Sopenharmony_ci	$(call descend,include/nolibc)
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_cinolibc_%: FORCE
8562306a36Sopenharmony_ci	$(call descend,include/nolibc,$(patsubst nolibc_%,%,$@))
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci# The perf build does not follow the descend function setup,
8862306a36Sopenharmony_ci# invoking it via it's own make rule.
8962306a36Sopenharmony_ciPERF_O   = $(if $(O),$(O)/tools/perf,)
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ciperf: FORCE
9262306a36Sopenharmony_ci	$(Q)mkdir -p $(PERF_O) .
9362306a36Sopenharmony_ci	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir=
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ciselftests: FORCE
9662306a36Sopenharmony_ci	$(call descend,testing/$@)
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_cithermal: FORCE
9962306a36Sopenharmony_ci	$(call descend,lib/$@)
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_citurbostat x86_energy_perf_policy intel-speed-select: FORCE
10262306a36Sopenharmony_ci	$(call descend,power/x86/$@)
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_citmon: FORCE
10562306a36Sopenharmony_ci	$(call descend,thermal/$@)
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_cithermometer: FORCE
10862306a36Sopenharmony_ci	$(call descend,thermal/$@)
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_cithermal-engine: FORCE thermal
11162306a36Sopenharmony_ci	$(call descend,thermal/$@)
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_cifreefall: FORCE
11462306a36Sopenharmony_ci	$(call descend,laptop/$@)
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_cikvm_stat: FORCE
11762306a36Sopenharmony_ci	$(call descend,kvm/$@)
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ciall: acpi cgroup counter cpupower gpio hv firewire \
12062306a36Sopenharmony_ci		perf selftests bootconfig spi turbostat usb \
12162306a36Sopenharmony_ci		virtio mm bpf x86_energy_perf_policy \
12262306a36Sopenharmony_ci		tmon freefall iio objtool kvm_stat wmi \
12362306a36Sopenharmony_ci		pci debugging tracing thermal thermometer thermal-engine
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ciacpi_install:
12662306a36Sopenharmony_ci	$(call descend,power/$(@:_install=),install)
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_cicpupower_install:
12962306a36Sopenharmony_ci	$(call descend,power/$(@:_install=),install)
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_cicgroup_install counter_install firewire_install gpio_install hv_install iio_install perf_install bootconfig_install spi_install usb_install virtio_install mm_install bpf_install objtool_install wmi_install pci_install debugging_install tracing_install:
13262306a36Sopenharmony_ci	$(call descend,$(@:_install=),install)
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ciselftests_install:
13562306a36Sopenharmony_ci	$(call descend,testing/$(@:_install=),install)
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_cithermal_install:
13862306a36Sopenharmony_ci	$(call descend,lib/$(@:_install=),install)
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_citurbostat_install x86_energy_perf_policy_install intel-speed-select_install:
14162306a36Sopenharmony_ci	$(call descend,power/x86/$(@:_install=),install)
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_citmon_install:
14462306a36Sopenharmony_ci	$(call descend,thermal/$(@:_install=),install)
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_cithermometer_install:
14762306a36Sopenharmony_ci	$(call descend,thermal/$(@:_install=),install)
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_cithermal-engine_install:
15062306a36Sopenharmony_ci	$(call descend,thermal/$(@:_install=),install)
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_cifreefall_install:
15362306a36Sopenharmony_ci	$(call descend,laptop/$(@:_install=),install)
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_cikvm_stat_install:
15662306a36Sopenharmony_ci	$(call descend,kvm/$(@:_install=),install)
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ciinstall: acpi_install cgroup_install counter_install cpupower_install gpio_install \
15962306a36Sopenharmony_ci		hv_install firewire_install iio_install \
16062306a36Sopenharmony_ci		perf_install selftests_install turbostat_install usb_install \
16162306a36Sopenharmony_ci		virtio_install mm_install bpf_install x86_energy_perf_policy_install \
16262306a36Sopenharmony_ci		tmon_install freefall_install objtool_install kvm_stat_install \
16362306a36Sopenharmony_ci		wmi_install pci_install debugging_install intel-speed-select_install \
16462306a36Sopenharmony_ci		tracing_install thermometer_install thermal-engine_install
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ciacpi_clean:
16762306a36Sopenharmony_ci	$(call descend,power/acpi,clean)
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_cicpupower_clean:
17062306a36Sopenharmony_ci	$(call descend,power/cpupower,clean)
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_cicgroup_clean counter_clean hv_clean firewire_clean bootconfig_clean spi_clean usb_clean virtio_clean mm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean firmware_clean debugging_clean tracing_clean:
17362306a36Sopenharmony_ci	$(call descend,$(@:_clean=),clean)
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_cilibapi_clean:
17662306a36Sopenharmony_ci	$(call descend,lib/api,clean)
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_cilibbpf_clean:
17962306a36Sopenharmony_ci	$(call descend,lib/bpf,clean)
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_cilibsubcmd_clean:
18262306a36Sopenharmony_ci	$(call descend,lib/subcmd,clean)
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ciperf_clean:
18562306a36Sopenharmony_ci	$(Q)mkdir -p $(PERF_O) .
18662306a36Sopenharmony_ci	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir= clean
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ciselftests_clean:
18962306a36Sopenharmony_ci	$(call descend,testing/$(@:_clean=),clean)
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_cithermal_clean:
19262306a36Sopenharmony_ci	$(call descend,lib/thermal,clean)
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_citurbostat_clean x86_energy_perf_policy_clean intel-speed-select_clean:
19562306a36Sopenharmony_ci	$(call descend,power/x86/$(@:_clean=),clean)
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_cithermometer_clean:
19862306a36Sopenharmony_ci	$(call descend,thermal/thermometer,clean)
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_cithermal-engine_clean:
20162306a36Sopenharmony_ci	$(call descend,thermal/thermal-engine,clean)
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_citmon_clean:
20462306a36Sopenharmony_ci	$(call descend,thermal/tmon,clean)
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_cifreefall_clean:
20762306a36Sopenharmony_ci	$(call descend,laptop/freefall,clean)
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_cibuild_clean:
21062306a36Sopenharmony_ci	$(call descend,build,clean)
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ciclean: acpi_clean cgroup_clean counter_clean cpupower_clean hv_clean firewire_clean \
21362306a36Sopenharmony_ci		perf_clean selftests_clean turbostat_clean bootconfig_clean spi_clean usb_clean virtio_clean \
21462306a36Sopenharmony_ci		mm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
21562306a36Sopenharmony_ci		freefall_clean build_clean libbpf_clean libsubcmd_clean \
21662306a36Sopenharmony_ci		gpio_clean objtool_clean leds_clean wmi_clean pci_clean firmware_clean debugging_clean \
21762306a36Sopenharmony_ci		intel-speed-select_clean tracing_clean thermal_clean thermometer_clean thermal-engine_clean
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci.PHONY: FORCE
220