tools/perf/build: Pass through all targets to Makefile.perf
[profile/ivi/kernel-x86-ivi.git] / tools / perf / Makefile
1
2 #
3 # Clear out the built-in rules GNU make defines by default (such as .o targets),
4 # so that we pass through all targets to Makefile.perf:
5 #
6 .SUFFIXES:
7
8 #
9 # Do a parallel build with multiple jobs, based on the number of CPUs online
10 # in this system: 'make -j8' on a 8-CPU system, etc.
11 #
12 # (To override it, run 'make JOBS=1' and similar.)
13 #
14 ifeq ($(JOBS),)
15   JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
16   ifeq ($(JOBS),)
17     JOBS := 1
18   endif
19 endif
20
21 export JOBS
22
23 define print_msg
24   @printf '    BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
25 endef
26
27 define make
28   @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@
29 endef
30
31 #
32 # Needed if no target specified:
33 #
34 all:
35         $(print_msg)
36         $(make)
37
38 #
39 # The clean target is not really parallel, don't print the jobs info:
40 #
41 clean:
42         $(make)
43
44 #
45 # All other targets get passed through:
46 #
47 %:
48         $(print_msg)
49         $(make)