Ingo Molnar | b016a0d | 2013-10-03 14:32:10 +0200 | [diff] [blame^] | 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 | |||||
Ingo Molnar | d24e473 | 2009-04-20 13:32:07 +0200 | [diff] [blame] | 8 | # |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 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. | ||||
Namhyung Kim | 67cbbd7 | 2012-02-23 16:08:14 +0900 | [diff] [blame] | 11 | # |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 12 | # (To override it, run 'make JOBS=1' and similar.) |
Namhyung Kim | 67cbbd7 | 2012-02-23 16:08:14 +0900 | [diff] [blame] | 13 | # |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 14 | ifeq ($(JOBS),) |
15 | JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null) | ||||
16 | ifeq ($(JOBS),) | ||||
17 | JOBS := 1 | ||||
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 18 | endif |
Jiri Olsa | 2bcd355 | 2012-08-07 15:20:43 +0200 | [diff] [blame] | 19 | endif |
Kirill A. Shutemov | f4e7ac0 | 2010-08-21 03:38:20 +0300 | [diff] [blame] | 20 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 21 | export JOBS |
Peter Hurley | 79d824e | 2013-01-27 20:51:22 -0500 | [diff] [blame] | 22 | |
Ingo Molnar | 73a725f | 2013-10-02 11:58:30 +0200 | [diff] [blame] | 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 | ||||
Ingo Molnar | d24e473 | 2009-04-20 13:32:07 +0200 | [diff] [blame] | 30 | |
Ingo Molnar | de0f03f | 2013-10-02 09:43:23 +0200 | [diff] [blame] | 31 | # |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 32 | # Needed if no target specified: |
Ingo Molnar | de0f03f | 2013-10-02 09:43:23 +0200 | [diff] [blame] | 33 | # |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 34 | all: |
Ingo Molnar | 73a725f | 2013-10-02 11:58:30 +0200 | [diff] [blame] | 35 | $(print_msg) |
36 | $(make) | ||||
Ingo Molnar | de0f03f | 2013-10-02 09:43:23 +0200 | [diff] [blame] | 37 | |
Ingo Molnar | 73a725f | 2013-10-02 11:58:30 +0200 | [diff] [blame] | 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 | # | ||||
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 47 | %: |
Ingo Molnar | 73a725f | 2013-10-02 11:58:30 +0200 | [diff] [blame] | 48 | $(print_msg) |
49 | $(make) |