xref: /openbmc/linux/tools/perf/Makefile (revision b016a0dd)
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#
14ifeq ($(JOBS),)
15  JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
16  ifeq ($(JOBS),)
17    JOBS := 1
18  endif
19endif
20
21export JOBS
22
23define print_msg
24  @printf '    BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
25endef
26
27define make
28  @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@
29endef
30
31#
32# Needed if no target specified:
33#
34all:
35	$(print_msg)
36	$(make)
37
38#
39# The clean target is not really parallel, don't print the jobs info:
40#
41clean:
42	$(make)
43
44#
45# All other targets get passed through:
46#
47%:
48	$(print_msg)
49	$(make)
50