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