From a54c8c111f8ce02a2343e412b58e772b25afb58e Mon Sep 17 00:00:00 2001 From: ksqsf Date: Sun, 1 Sep 2024 17:04:40 +0200 Subject: [PATCH] fix(build): limit default parallelism to 8 cores On systems where nproc is not available, it will leave only -j which causes unlimited parallelism. --- Makefile | 2 +- deps.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1c92147cb3..f9e3eb9f92 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ prefix ?= $(DESTDIR)/usr endif ifndef NOPARALLEL -export MAKEFLAGS+=" -j$(( $(nproc) + 1)) " +export MAKEFLAGS+=" -j$$(( $$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 8) + 1)) " endif debug install-debug uninstall-debug test-debug: build ?= debug diff --git a/deps.mk b/deps.mk index fe68ccddc7..113f78c060 100644 --- a/deps.mk +++ b/deps.mk @@ -4,7 +4,7 @@ rime_root = $(CURDIR) src_dir = $(rime_root)/deps ifndef NOPARALLEL -export MAKEFLAGS+=" -j$(( $(nproc) + 1)) " +export MAKEFLAGS+=" -j$$(( $$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 8) + 1)) " endif build ?= build