]>
Commit | Line | Data |
---|---|---|
4e34d958 | 1 | # |
bd69cc28 IM |
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. | |
79d824e3 | 4 | # |
bd69cc28 | 5 | # (To override it, run 'make JOBS=1' and similar.) |
4e22db46 | 6 | # |
bd69cc28 IM |
7 | ifeq ($(JOBS),) |
8 | JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null) | |
9 | ifeq ($(JOBS),) | |
10 | JOBS := 1 | |
8e1b3f68 | 11 | endif |
2bcd355b | 12 | endif |
f4e7ac0a | 13 | |
bd69cc28 | 14 | export JOBS |
b1b02673 | 15 | |
73a725f0 IM |
16 | define print_msg |
17 | @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n' | |
18 | endef | |
19 | ||
20 | define make | |
21 | @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@ | |
22 | endef | |
d24e473e | 23 | |
de0f03fb | 24 | # |
bd69cc28 | 25 | # Needed if no target specified: |
de0f03fb | 26 | # |
bd69cc28 | 27 | all: |
73a725f0 IM |
28 | $(print_msg) |
29 | $(make) | |
30 | ||
31 | # | |
32 | # The clean target is not really parallel, don't print the jobs info: | |
33 | # | |
34 | clean: | |
35 | $(make) | |
c72e3f04 | 36 | |
73a725f0 IM |
37 | # |
38 | # All other targets get passed through: | |
39 | # | |
bd69cc28 | 40 | %: |
73a725f0 IM |
41 | $(print_msg) |
42 | $(make) |