blob: 6f6f13a13bb69e607c100e1622db6f325ee1c398 [file] [log] [blame]
Ingo Molnarb016a0d2013-10-03 14:32:10 +02001
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
Ingo Molnard24e4732009-04-20 13:32:07 +02008#
Ingo Molnarbd69cc22013-10-02 11:49:08 +02009# 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.
Namhyung Kim67cbbd72012-02-23 16:08:14 +090011#
Ingo Molnarbd69cc22013-10-02 11:49:08 +020012# (To override it, run 'make JOBS=1' and similar.)
Namhyung Kim67cbbd72012-02-23 16:08:14 +090013#
Ingo Molnarbd69cc22013-10-02 11:49:08 +020014ifeq ($(JOBS),)
15 JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
16 ifeq ($(JOBS),)
17 JOBS := 1
Jiri Olsa8e1b3f62013-04-15 04:06:58 +020018 endif
Jiri Olsa2bcd3552012-08-07 15:20:43 +020019endif
Kirill A. Shutemovf4e7ac02010-08-21 03:38:20 +030020
Ingo Molnarbd69cc22013-10-02 11:49:08 +020021export JOBS
Peter Hurley79d824e2013-01-27 20:51:22 -050022
Ingo Molnar73a725f2013-10-02 11:58:30 +020023define 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
Ingo Molnard24e4732009-04-20 13:32:07 +020030
Ingo Molnarde0f03f2013-10-02 09:43:23 +020031#
Ingo Molnarbd69cc22013-10-02 11:49:08 +020032# Needed if no target specified:
Ingo Molnarde0f03f2013-10-02 09:43:23 +020033#
Ingo Molnarbd69cc22013-10-02 11:49:08 +020034all:
Ingo Molnar73a725f2013-10-02 11:58:30 +020035 $(print_msg)
36 $(make)
Ingo Molnarde0f03f2013-10-02 09:43:23 +020037
Ingo Molnar73a725f2013-10-02 11:58:30 +020038#
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#
Ingo Molnarbd69cc22013-10-02 11:49:08 +020047%:
Ingo Molnar73a725f2013-10-02 11:58:30 +020048 $(print_msg)
49 $(make)