xref: /openbmc/linux/tools/perf/Makefile (revision 73a725f0)
1#
2# Do a parallel build with multiple jobs, based on the number of CPUs online
3# in this system: 'make -j8' on a 8-CPU system, etc.
4#
5# (To override it, run 'make JOBS=1' and similar.)
6#
7ifeq ($(JOBS),)
8  JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
9  ifeq ($(JOBS),)
10    JOBS := 1
11  endif
12endif
13
14export JOBS
15
16define print_msg
17  @printf '    BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
18endef
19
20define make
21  @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@
22endef
23
24#
25# Needed if no target specified:
26#
27all:
28	$(print_msg)
29	$(make)
30
31#
32# The clean target is not really parallel, don't print the jobs info:
33#
34clean:
35	$(make)
36
37#
38# All other targets get passed through:
39#
40%:
41	$(print_msg)
42	$(make)
43