mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
make: fix nproc for buildtest
This commit is contained in:
parent
81bfb0c97a
commit
625d2449d8
@ -72,6 +72,9 @@ include $(RIOTMAKE)/docker.inc.mk
|
|||||||
# include color echo macros
|
# include color echo macros
|
||||||
include $(RIOTMAKE)/color.inc.mk
|
include $(RIOTMAKE)/color.inc.mk
|
||||||
|
|
||||||
|
# include concurrency helpers
|
||||||
|
include $(RIOTMAKE)/info-nproc.inc.mk
|
||||||
|
|
||||||
GLOBAL_GOALS := buildtest info-boards-supported info-boards-features-missing info-buildsizes info-buildsizes-diff
|
GLOBAL_GOALS := buildtest info-boards-supported info-boards-features-missing info-buildsizes info-buildsizes-diff
|
||||||
ifneq (, $(filter $(GLOBAL_GOALS), $(MAKECMDGOALS)))
|
ifneq (, $(filter $(GLOBAL_GOALS), $(MAKECMDGOALS)))
|
||||||
BOARD=none
|
BOARD=none
|
||||||
|
33
makefiles/info-nproc.inc.mk
Normal file
33
makefiles/info-nproc.inc.mk
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
ifneq (, $(filter buildtest info-concurrency, $(MAKECMDGOALS)))
|
||||||
|
ifeq (, $(strip $(NPROC)))
|
||||||
|
# Linux (utility program)
|
||||||
|
NPROC := $(shell nproc 2>/dev/null)
|
||||||
|
|
||||||
|
ifeq (, $(strip $(NPROC)))
|
||||||
|
# Linux (generic)
|
||||||
|
NPROC := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
|
||||||
|
endif
|
||||||
|
ifeq (, $(strip $(NPROC)))
|
||||||
|
# BSD (at least FreeBSD and Mac OSX)
|
||||||
|
NPROC := $(shell sysctl -n hw.ncpu 2>/dev/null)
|
||||||
|
endif
|
||||||
|
ifeq (, $(strip $(NPROC)))
|
||||||
|
# Fallback
|
||||||
|
NPROC := 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
NPROC := $(shell echo $$(($(NPROC) + 1)))
|
||||||
|
|
||||||
|
ifneq (, $(NPROC_MAX))
|
||||||
|
NPROC := $(shell if [ ${NPROC} -gt $(NPROC_MAX) ]; then echo $(NPROC_MAX); else echo ${NPROC}; fi)
|
||||||
|
endif
|
||||||
|
ifneq (, $(NPROC_MIN))
|
||||||
|
NPROC := $(shell if [ ${NPROC} -lt $(NPROC_MIN) ]; then echo $(NPROC_MIN); else echo ${NPROC}; fi)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: info-concurrency
|
||||||
|
|
||||||
|
info-concurrency:
|
||||||
|
@echo "$(NPROC)"
|
@ -90,38 +90,6 @@ info-build:
|
|||||||
@echo ''
|
@echo ''
|
||||||
@echo -e 'MAKEFILE_LIST:$(patsubst %, \n\t%, $(abspath $(MAKEFILE_LIST)))'
|
@echo -e 'MAKEFILE_LIST:$(patsubst %, \n\t%, $(abspath $(MAKEFILE_LIST)))'
|
||||||
|
|
||||||
ifneq (, $(filter buildtest info-concurrency, $(MAKECMDGOALS)))
|
|
||||||
ifeq (, $(strip $(NPROC)))
|
|
||||||
# Linux (utility program)
|
|
||||||
NPROC := $(shell nproc 2>/dev/null)
|
|
||||||
|
|
||||||
ifeq (, $(strip $(NPROC)))
|
|
||||||
# Linux (generic)
|
|
||||||
NPROC := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
|
|
||||||
endif
|
|
||||||
ifeq (, $(strip $(NPROC)))
|
|
||||||
# BSD (at least FreeBSD and Mac OSX)
|
|
||||||
NPROC := $(shell sysctl -n hw.ncpu 2>/dev/null)
|
|
||||||
endif
|
|
||||||
ifeq (, $(strip $(NPROC)))
|
|
||||||
# Fallback
|
|
||||||
NPROC := 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
NPROC := $(shell echo $$(($(NPROC) + 1)))
|
|
||||||
|
|
||||||
ifneq (, $(NPROC_MAX))
|
|
||||||
NPROC := $(shell if [ ${NPROC} -gt $(NPROC_MAX) ]; then echo $(NPROC_MAX); else echo ${NPROC}; fi)
|
|
||||||
endif
|
|
||||||
ifneq (, $(NPROC_MIN))
|
|
||||||
NPROC := $(shell if [ ${NPROC} -lt $(NPROC_MIN) ]; then echo $(NPROC_MIN); else echo ${NPROC}; fi)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
info-concurrency:
|
|
||||||
@echo "$(NPROC)"
|
|
||||||
|
|
||||||
info-files: QUIET := 0
|
info-files: QUIET := 0
|
||||||
info-files:
|
info-files:
|
||||||
@( \
|
@( \
|
||||||
|
Loading…
Reference in New Issue
Block a user