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 '  hv         - tools used when in Hyper-V clients'
16	@echo '  iio        - IIO tools'
17	@echo '  lguest     - a minimal 32-bit x86 hypervisor'
18	@echo '  perf       - Linux performance measurement and analysis tool'
19	@echo '  selftests  - various kernel selftests'
20	@echo '  turbostat  - Intel CPU idle stats and freq reporting tool'
21	@echo '  usb        - USB testing tools'
22	@echo '  virtio     - vhost test module'
23	@echo '  net        - misc networking tools'
24	@echo '  vm         - misc vm tools'
25	@echo '  x86_energy_perf_policy - Intel energy policy tool'
26	@echo '  tmon       - thermal monitoring and tuning tool'
27	@echo '  freefall   - laptop accelerometer program for disk protection'
28	@echo ''
29	@echo 'You can do:'
30	@echo ' $$ make -C tools/ <tool>_install'
31	@echo ''
32	@echo '  from the kernel command line to build and install one of'
33	@echo '  the tools above'
34	@echo ''
35	@echo '  $$ make tools/all'
36	@echo ''
37	@echo '  builds all tools.'
38	@echo ''
39	@echo '  $$ make tools/install'
40	@echo ''
41	@echo '  installs all tools.'
42	@echo ''
43	@echo 'Cleaning targets:'
44	@echo ''
45	@echo '  all of the above with the "_clean" string appended cleans'
46	@echo '    the respective build directory.'
47	@echo '  clean: a summary clean target to clean _all_ folders'
48
49acpi: FORCE
50	$(call descend,power/$@)
51
52cpupower: FORCE
53	$(call descend,power/$@)
54
55cgroup firewire hv guest usb virtio vm net iio: FORCE
56	$(call descend,$@)
57
58liblockdep: FORCE
59	$(call descend,lib/lockdep)
60
61libapi: FORCE
62	$(call descend,lib/api)
63
64# The perf build does not follow the descend function setup,
65# invoking it via it's own make rule.
66PERF_O   = $(if $(O),$(O)/tools/perf,)
67
68perf: FORCE
69	$(Q)mkdir -p $(PERF_O) .
70	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir=
71
72selftests: FORCE
73	$(call descend,testing/$@)
74
75turbostat x86_energy_perf_policy: FORCE
76	$(call descend,power/x86/$@)
77
78tmon: FORCE
79	$(call descend,thermal/$@)
80
81freefall: FORCE
82	$(call descend,laptop/$@)
83
84all: acpi cgroup cpupower hv firewire lguest \
85		perf selftests turbostat usb \
86		virtio vm net x86_energy_perf_policy \
87		tmon freefall
88
89acpi_install:
90	$(call descend,power/$(@:_install=),install)
91
92cpupower_install:
93	$(call descend,power/$(@:_install=),install)
94
95cgroup_install firewire_install hv_install lguest_install perf_install usb_install virtio_install vm_install net_install:
96	$(call descend,$(@:_install=),install)
97
98selftests_install:
99	$(call descend,testing/$(@:_clean=),install)
100
101turbostat_install x86_energy_perf_policy_install:
102	$(call descend,power/x86/$(@:_install=),install)
103
104tmon_install:
105	$(call descend,thermal/$(@:_install=),install)
106
107freefall_install:
108	$(call descend,laptop/$(@:_install=),install)
109
110install: acpi_install cgroup_install cpupower_install hv_install firewire_install lguest_install \
111		perf_install selftests_install turbostat_install usb_install \
112		virtio_install vm_install net_install x86_energy_perf_policy_install \
113		tmon_install freefall_install
114
115acpi_clean:
116	$(call descend,power/acpi,clean)
117
118cpupower_clean:
119	$(call descend,power/cpupower,clean)
120
121cgroup_clean hv_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clean net_clean iio_clean:
122	$(call descend,$(@:_clean=),clean)
123
124liblockdep_clean:
125	$(call descend,lib/lockdep,clean)
126
127libapi_clean:
128	$(call descend,lib/api,clean)
129
130perf_clean:
131	$(call descend,$(@:_clean=),clean)
132
133selftests_clean:
134	$(call descend,testing/$(@:_clean=),clean)
135
136turbostat_clean x86_energy_perf_policy_clean:
137	$(call descend,power/x86/$(@:_clean=),clean)
138
139tmon_clean:
140	$(call descend,thermal/tmon,clean)
141
142freefall_clean:
143	$(call descend,laptop/freefall,clean)
144
145clean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean lguest_clean \
146		perf_clean selftests_clean turbostat_clean usb_clean virtio_clean \
147		vm_clean net_clean iio_clean x86_energy_perf_policy_clean tmon_clean \
148		freefall_clean
149
150.PHONY: FORCE
151