xref: /openbmc/linux/tools/perf/Makefile (revision 73a725f0)
1bd69cc28SIngo Molnar#
2bd69cc28SIngo Molnar# Do a parallel build with multiple jobs, based on the number of CPUs online
3bd69cc28SIngo Molnar# in this system: 'make -j8' on a 8-CPU system, etc.
4bd69cc28SIngo Molnar#
5bd69cc28SIngo Molnar# (To override it, run 'make JOBS=1' and similar.)
6bd69cc28SIngo Molnar#
7bd69cc28SIngo Molnarifeq ($(JOBS),)
8bd69cc28SIngo Molnar  JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
9bd69cc28SIngo Molnar  ifeq ($(JOBS),)
10bd69cc28SIngo Molnar    JOBS := 1
11bd69cc28SIngo Molnar  endif
12bd69cc28SIngo Molnarendif
13c29ede61SArnaldo Carvalho de Melo
14bd69cc28SIngo Molnarexport JOBS
15bd69cc28SIngo Molnar
1673a725f0SIngo Molnardefine print_msg
1773a725f0SIngo Molnar  @printf '    BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
1873a725f0SIngo Molnarendef
1973a725f0SIngo Molnar
2073a725f0SIngo Molnardefine make
2173a725f0SIngo Molnar  @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@
2273a725f0SIngo Molnarendef
23bd69cc28SIngo Molnar
24bd69cc28SIngo Molnar#
25bd69cc28SIngo Molnar# Needed if no target specified:
26bd69cc28SIngo Molnar#
27a3d1ee10SMichael Wittenall:
2873a725f0SIngo Molnar	$(print_msg)
2973a725f0SIngo Molnar	$(make)
3086470930SIngo Molnar
3173a725f0SIngo Molnar#
3273a725f0SIngo Molnar# The clean target is not really parallel, don't print the jobs info:
3373a725f0SIngo Molnar#
3473a725f0SIngo Molnarclean:
3573a725f0SIngo Molnar	$(make)
3673a725f0SIngo Molnar
3773a725f0SIngo Molnar#
3873a725f0SIngo Molnar# All other targets get passed through:
3973a725f0SIngo Molnar#
40bd69cc28SIngo Molnar%:
4173a725f0SIngo Molnar	$(print_msg)
4273a725f0SIngo Molnar	$(make)
43