Show autodetected cores when no $(JOBS) is specified

If there is a more readable way of doing this, please point out.

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
This commit is contained in:
Timothy Gu 2014-10-18 17:29:48 +00:00
parent 2eb2698427
commit df1b36c387
1 changed files with 6 additions and 1 deletions

View File

@ -23,7 +23,12 @@ PKG_CDN := d1yihgixbnrglp.cloudfront.net
PWD := $(shell pwd)
SHELL := bash
NPROCS := $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)
JOBS := $(shell printf "$(DEFAULT_MAX_JOBS)\n$(NPROCS)" | sort -n | head -1)
JOBS_AUTO := $(shell printf "$(DEFAULT_MAX_JOBS)\n$(NPROCS)" | sort -n | head -1)
JOBS := $(strip $(if $(findstring undefined,$(origin JOBS)),\
$(info [using autodetected $(JOBS_AUTO) job(s)]) \
$(JOBS_AUTO)\
,\
$(JOBS)))
DATE := $(shell gdate --help >/dev/null 2>&1 && echo g)date
INSTALL := $(shell ginstall --help >/dev/null 2>&1 && echo g)install