From ba024fcfc07a52d65c5663b82f36672106f1bbec Mon Sep 17 00:00:00 2001 From: Jerome Robert Date: Mon, 28 Dec 2015 19:28:42 +0100 Subject: [PATCH] Allow to force the number of parallel make job This is particularly useful when using distcc --- Makefile.rule | 4 ++++ Makefile.system | 4 ++++ getarch.c | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile.rule b/Makefile.rule index f7ee09f52..0d7c45ead 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -108,6 +108,10 @@ NO_AFFINITY = 1 # Don't use parallel make. # NO_PARALLEL_MAKE = 1 +# Force number of make jobs. The default is the number of logical CPU of the host. +# This is particularly useful when using distcc +# MAKE_NB_JOBS = 2 + # If you would like to know minute performance report of GotoBLAS. # FUNCTION_PROFILE = 1 diff --git a/Makefile.system b/Makefile.system index f1598b910..9de9232ad 100644 --- a/Makefile.system +++ b/Makefile.system @@ -139,6 +139,10 @@ NO_PARALLEL_MAKE=0 endif GETARCH_FLAGS += -DNO_PARALLEL_MAKE=$(NO_PARALLEL_MAKE) +ifdef MAKE_NB_JOBS +GETARCH_FLAGS += -DMAKE_NB_JOBS=$(MAKE_NB_JOBS) +endif + ifeq ($(HOSTCC), loongcc) GETARCH_FLAGS += -static endif diff --git a/getarch.c b/getarch.c index 024ac4b3d..272b123cd 100644 --- a/getarch.c +++ b/getarch.c @@ -998,7 +998,9 @@ int main(int argc, char *argv[]){ #endif #endif -#if NO_PARALLEL_MAKE==1 +#ifdef MAKE_NB_JOBS + printf("MAKE += -j %d\n", MAKE_NB_JOBS); +#elif NO_PARALLEL_MAKE==1 printf("MAKE += -j 1\n"); #else #ifndef OS_WINDOWS