2012-10-02 00:32:51 +08:00
|
|
|
#
|
2013-10-02 17:49:08 +08:00
|
|
|
# Do a parallel build with multiple jobs, based on the number of CPUs online
|
|
|
|
# in this system: 'make -j8' on a 8-CPU system, etc.
|
2013-01-28 09:51:22 +08:00
|
|
|
#
|
2013-10-02 17:49:08 +08:00
|
|
|
# (To override it, run 'make JOBS=1' and similar.)
|
2013-05-24 20:35:24 +08:00
|
|
|
#
|
2013-10-02 17:49:08 +08:00
|
|
|
ifeq ($(JOBS),)
|
|
|
|
JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
|
|
|
|
ifeq ($(JOBS),)
|
|
|
|
JOBS := 1
|
2013-04-15 10:06:58 +08:00
|
|
|
endif
|
2012-08-07 21:20:43 +08:00
|
|
|
endif
|
2010-08-21 08:38:20 +08:00
|
|
|
|
2013-10-02 17:49:08 +08:00
|
|
|
export JOBS
|
2010-08-11 02:37:34 +08:00
|
|
|
|
2013-10-02 17:58:30 +08:00
|
|
|
define print_msg
|
|
|
|
@printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
|
|
|
|
endef
|
|
|
|
|
|
|
|
define make
|
|
|
|
@$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@
|
|
|
|
endef
|
2009-04-20 19:32:07 +08:00
|
|
|
|
2013-10-02 15:43:23 +08:00
|
|
|
#
|
2013-10-02 17:49:08 +08:00
|
|
|
# Needed if no target specified:
|
2013-10-02 15:43:23 +08:00
|
|
|
#
|
2013-10-02 17:49:08 +08:00
|
|
|
all:
|
2013-10-02 17:58:30 +08:00
|
|
|
$(print_msg)
|
|
|
|
$(make)
|
|
|
|
|
|
|
|
#
|
|
|
|
# The clean target is not really parallel, don't print the jobs info:
|
|
|
|
#
|
|
|
|
clean:
|
|
|
|
$(make)
|
2013-10-01 22:28:09 +08:00
|
|
|
|
2013-10-02 17:58:30 +08:00
|
|
|
#
|
|
|
|
# All other targets get passed through:
|
|
|
|
#
|
2013-10-02 17:49:08 +08:00
|
|
|
%:
|
2013-10-02 17:58:30 +08:00
|
|
|
$(print_msg)
|
|
|
|
$(make)
|